From 6a953a95c521945867ae50e6c2b63b2cb2637dfb Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 1 Sep 2023 13:41:03 +0000 Subject: [PATCH] Generated v4.1.0 --- CHANGELOG.md | 13 + README.md | 7 +- docs/Api/BackendApi.md | 4 + docs/Api/LoggingNewrelicotlpApi.md | 240 +++ docs/Api/RateLimiterApi.md | 4 +- docs/Api/SecretStoreApi.md | 4 +- docs/Api/TlsDomainsApi.md | 4 +- docs/Api/TlsSubscriptionsApi.md | 8 +- docs/Model/Backend.md | 1 + docs/Model/BackendResponse.md | 1 + docs/Model/LoggingNewrelicotlpAdditional.md | 13 + docs/Model/LoggingNewrelicotlpResponse.md | 22 + docs/Model/RateLimiter.md | 2 +- docs/Model/RateLimiterResponse.md | 2 +- lib/Api/BackendApi.php | 28 + lib/Api/LoggingNewrelicotlpApi.php | 2060 +++++++++++++++++++ lib/Api/SecretStoreApi.php | 8 +- lib/Api/TlsDomainsApi.php | 10 +- lib/Api/TlsSubscriptionsApi.php | 20 +- lib/Configuration.php | 4 +- lib/Model/Backend.php | 39 + lib/Model/BackendResponse.php | 39 + lib/Model/LoggingNewrelicotlpAdditional.php | 438 ++++ lib/Model/LoggingNewrelicotlpResponse.php | 778 +++++++ lib/Model/RateLimiter.php | 2 + lib/Model/RateLimiterResponse.php | 2 + sig.json | 2 +- 27 files changed, 3720 insertions(+), 35 deletions(-) create mode 100644 docs/Api/LoggingNewrelicotlpApi.md create mode 100644 docs/Model/LoggingNewrelicotlpAdditional.md create mode 100644 docs/Model/LoggingNewrelicotlpResponse.md create mode 100644 lib/Api/LoggingNewrelicotlpApi.php create mode 100644 lib/Model/LoggingNewrelicotlpAdditional.php create mode 100644 lib/Model/LoggingNewrelicotlpResponse.php diff --git a/CHANGELOG.md b/CHANGELOG.md index ba925f42..8c7dacfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [v4.1.0](https://github.com/fastly/fastly-php/releases/tag/release/v4.1.0) (2023-09-01) + +**Enhancements:** + +- feat(backend): support share_key field. +- feat(events): support extra created_at filters. +- feat(logging/newrelic): add OTLP endpoints. +- feat(tls/subscriptions): support self_managed_http_challenge field. + +**Documentation:** + +- doc(secretstore): correct description for GET endpoint. + ## [v4.0.0](https://github.com/fastly/fastly-php/releases/tag/release/v4.0.0) (2023-07-31) **Breaking:** diff --git a/README.md b/README.md index 23088959..a0a873ad 100644 --- a/README.md +++ b/README.md @@ -364,6 +364,11 @@ Class | Method | Description [*LoggingNewrelicApi*](docs/Api/LoggingNewrelicApi.md) | [**getLogNewrelic**](docs/Api/LoggingNewrelicApi.md#getlognewrelic) | Get a New Relic log endpoint [*LoggingNewrelicApi*](docs/Api/LoggingNewrelicApi.md) | [**listLogNewrelic**](docs/Api/LoggingNewrelicApi.md#listlognewrelic) | List New Relic log endpoints [*LoggingNewrelicApi*](docs/Api/LoggingNewrelicApi.md) | [**updateLogNewrelic**](docs/Api/LoggingNewrelicApi.md#updatelognewrelic) | Update a New Relic log endpoint +[*LoggingNewrelicotlpApi*](docs/Api/LoggingNewrelicotlpApi.md) | [**createLogNewrelicotlp**](docs/Api/LoggingNewrelicotlpApi.md#createlognewrelicotlp) | Create a New Relic OTLP endpoint +[*LoggingNewrelicotlpApi*](docs/Api/LoggingNewrelicotlpApi.md) | [**deleteLogNewrelicotlp**](docs/Api/LoggingNewrelicotlpApi.md#deletelognewrelicotlp) | Delete a New Relic OTLP endpoint +[*LoggingNewrelicotlpApi*](docs/Api/LoggingNewrelicotlpApi.md) | [**getLogNewrelicotlp**](docs/Api/LoggingNewrelicotlpApi.md#getlognewrelicotlp) | Get a New Relic OTLP endpoint +[*LoggingNewrelicotlpApi*](docs/Api/LoggingNewrelicotlpApi.md) | [**listLogNewrelicotlp**](docs/Api/LoggingNewrelicotlpApi.md#listlognewrelicotlp) | List New Relic OTLP endpoints +[*LoggingNewrelicotlpApi*](docs/Api/LoggingNewrelicotlpApi.md) | [**updateLogNewrelicotlp**](docs/Api/LoggingNewrelicotlpApi.md#updatelognewrelicotlp) | Update a New Relic log endpoint [*LoggingOpenstackApi*](docs/Api/LoggingOpenstackApi.md) | [**createLogOpenstack**](docs/Api/LoggingOpenstackApi.md#createlogopenstack) | Create an OpenStack log endpoint [*LoggingOpenstackApi*](docs/Api/LoggingOpenstackApi.md) | [**deleteLogOpenstack**](docs/Api/LoggingOpenstackApi.md#deletelogopenstack) | Delete an OpenStack log endpoint [*LoggingOpenstackApi*](docs/Api/LoggingOpenstackApi.md) | [**getLogOpenstack**](docs/Api/LoggingOpenstackApi.md#getlogopenstack) | Get an OpenStack log endpoint @@ -458,7 +463,7 @@ Class | Method | Description [*SecretStoreApi*](docs/Api/SecretStoreApi.md) | [**clientKey**](docs/Api/SecretStoreApi.md#clientkey) | Create new client key [*SecretStoreApi*](docs/Api/SecretStoreApi.md) | [**createSecretStore**](docs/Api/SecretStoreApi.md#createsecretstore) | Create new secret store [*SecretStoreApi*](docs/Api/SecretStoreApi.md) | [**deleteSecretStore**](docs/Api/SecretStoreApi.md#deletesecretstore) | Delete secret store -[*SecretStoreApi*](docs/Api/SecretStoreApi.md) | [**getSecretStore**](docs/Api/SecretStoreApi.md#getsecretstore) | Create secret store by ID +[*SecretStoreApi*](docs/Api/SecretStoreApi.md) | [**getSecretStore**](docs/Api/SecretStoreApi.md#getsecretstore) | Get secret store by ID [*SecretStoreApi*](docs/Api/SecretStoreApi.md) | [**getSecretStores**](docs/Api/SecretStoreApi.md#getsecretstores) | Get all secret stores [*SecretStoreApi*](docs/Api/SecretStoreApi.md) | [**signingKey**](docs/Api/SecretStoreApi.md#signingkey) | Get public key [*SecretStoreItemApi*](docs/Api/SecretStoreItemApi.md) | [**createSecret**](docs/Api/SecretStoreItemApi.md#createsecret) | Create a new secret in a store. diff --git a/docs/Api/BackendApi.md b/docs/Api/BackendApi.md index 274282df..463f7c26 100644 --- a/docs/Api/BackendApi.md +++ b/docs/Api/BackendApi.md @@ -52,6 +52,7 @@ $options['name'] = 'name_example'; // string | The name of the backend. $options['override_host'] = 'override_host_example'; // string | If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL. $options['port'] = 56; // int | Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request. $options['request_condition'] = 'request_condition_example'; // string | Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests. +$options['share_key'] = 'share_key_example'; // string | Value that when shared across backends will enable those backends to share the same health check. $options['shield'] = 'shield_example'; // string | Identifier of the POP to use as a [shield](https://docs.fastly.com/en/guides/shielding). $options['ssl_ca_cert'] = 'ssl_ca_cert_example'; // string | CA certificate attached to origin. $options['ssl_cert_hostname'] = 'ssl_cert_hostname_example'; // string | Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all. @@ -98,6 +99,7 @@ Name | Type | Description | Notes **override_host** | **string** | If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL. | [optional] **port** | **int** | Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request. | [optional] **request_condition** | **string** | Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests. | [optional] +**share_key** | **string** | Value that when shared across backends will enable those backends to share the same health check. | [optional] **shield** | **string** | Identifier of the POP to use as a [shield](https://docs.fastly.com/en/guides/shielding). | [optional] **ssl_ca_cert** | **string** | CA certificate attached to origin. | [optional] **ssl_cert_hostname** | **string** | Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all. | [optional] @@ -261,6 +263,7 @@ $options['name'] = 'name_example'; // string | The name of the backend. $options['override_host'] = 'override_host_example'; // string | If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL. $options['port'] = 56; // int | Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request. $options['request_condition'] = 'request_condition_example'; // string | Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests. +$options['share_key'] = 'share_key_example'; // string | Value that when shared across backends will enable those backends to share the same health check. $options['shield'] = 'shield_example'; // string | Identifier of the POP to use as a [shield](https://docs.fastly.com/en/guides/shielding). $options['ssl_ca_cert'] = 'ssl_ca_cert_example'; // string | CA certificate attached to origin. $options['ssl_cert_hostname'] = 'ssl_cert_hostname_example'; // string | Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all. @@ -308,6 +311,7 @@ Name | Type | Description | Notes **override_host** | **string** | If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL. | [optional] **port** | **int** | Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request. | [optional] **request_condition** | **string** | Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests. | [optional] +**share_key** | **string** | Value that when shared across backends will enable those backends to share the same health check. | [optional] **shield** | **string** | Identifier of the POP to use as a [shield](https://docs.fastly.com/en/guides/shielding). | [optional] **ssl_ca_cert** | **string** | CA certificate attached to origin. | [optional] **ssl_cert_hostname** | **string** | Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all. | [optional] diff --git a/docs/Api/LoggingNewrelicotlpApi.md b/docs/Api/LoggingNewrelicotlpApi.md new file mode 100644 index 00000000..2b60055f --- /dev/null +++ b/docs/Api/LoggingNewrelicotlpApi.md @@ -0,0 +1,240 @@ +# Fastly\Api\LoggingNewrelicotlpApi + + +```php +$apiInstance = new Fastly\Api\LoggingNewrelicotlpApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +``` + +## Methods + +Method | Fastly API endpoint | Description +------------- | ------------- | ------------- +[**createLogNewrelicotlp()**](LoggingNewrelicotlpApi.md#createLogNewrelicotlp) | **POST** /service/{service_id}/version/{version_id}/logging/newrelicotlp | Create a New Relic OTLP endpoint +[**deleteLogNewrelicotlp()**](LoggingNewrelicotlpApi.md#deleteLogNewrelicotlp) | **DELETE** /service/{service_id}/version/{version_id}/logging/newrelicotlp/{logging_newrelicotlp_name} | Delete a New Relic OTLP endpoint +[**getLogNewrelicotlp()**](LoggingNewrelicotlpApi.md#getLogNewrelicotlp) | **GET** /service/{service_id}/version/{version_id}/logging/newrelicotlp/{logging_newrelicotlp_name} | Get a New Relic OTLP endpoint +[**listLogNewrelicotlp()**](LoggingNewrelicotlpApi.md#listLogNewrelicotlp) | **GET** /service/{service_id}/version/{version_id}/logging/newrelicotlp | List New Relic OTLP endpoints +[**updateLogNewrelicotlp()**](LoggingNewrelicotlpApi.md#updateLogNewrelicotlp) | **PUT** /service/{service_id}/version/{version_id}/logging/newrelicotlp/{logging_newrelicotlp_name} | Update a New Relic log endpoint + + +## `createLogNewrelicotlp()` + +```php +createLogNewrelicotlp($options): \Fastly\Model\LoggingNewrelicotlpResponse // Create a New Relic OTLP endpoint +``` + +Create a New Relic OTLP logging object for a particular service and version. + +### Example +```php + $options['service_id'] = 'service_id_example'; // string | Alphanumeric string identifying the service. +$options['version_id'] = 56; // int | Integer identifying a service version. +$options['name'] = 'name_example'; // string | The name for the real-time logging configuration. +$options['placement'] = 'placement_example'; // string | Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. +$options['response_condition'] = 'response_condition_example'; // string | The name of an existing condition in the configured endpoint, or leave blank to always execute. +$options['format'] = '{\"timestamp\":\"%{begin:%Y-%m-%dT%H:%M:%S}t\",\"time_elapsed\":\"%{time.elapsed.usec}V\",\"is_tls\":\"%{if(req.is_ssl, \\\"true\\\", \\\"false\\\")}V\",\"client_ip\":\"%{req.http.Fastly-Client-IP}V\",\"geo_city\":\"%{client.geo.city}V\",\"geo_country_code\":\"%{client.geo.country_code}V\",\"request\":\"%{req.request}V\",\"host\":\"%{req.http.Fastly-Orig-Host}V\",\"url\":\"%{json.escape(req.url)}V\",\"request_referer\":\"%{json.escape(req.http.Referer)}V\",\"request_user_agent\":\"%{json.escape(req.http.User-Agent)}V\",\"request_accept_language\":\"%{json.escape(req.http.Accept-Language)}V\",\"request_accept_charset\":\"%{json.escape(req.http.Accept-Charset)}V\",\"cache_status\":\"%{regsub(fastly_info.state, \\\"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\\\", \\\"\\\\2\\\\3\\\") }V\"}'; // string | A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). +$options['format_version'] = self::FORMAT_VERSION_v2; // int | The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. +$options['token'] = 'token_example'; // string | The Insert API key from the Account page of your New Relic account. Required. +$options['region'] = 'US'; // string | The region to which to stream logs. +$options['url'] = 'null'; // string | (Optional) URL of the New Relic Trace Observer, if you are using New Relic Infinite Tracing. + +try { + $result = $apiInstance->createLogNewrelicotlp($options); +} catch (Exception $e) { + echo 'Exception when calling LoggingNewrelicotlpApi->createLogNewrelicotlp: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**service_id** | **string** | Alphanumeric string identifying the service. | +**version_id** | **int** | Integer identifying a service version. | +**name** | **string** | The name for the real-time logging configuration. | [optional] +**placement** | **string** | Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. | [optional] [one of: 'none', 'waf_debug', 'null'] +**response_condition** | **string** | The name of an existing condition in the configured endpoint, or leave blank to always execute. | [optional] +**format** | **string** | A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). | [optional] [defaults to '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}'] +**format_version** | **int** | The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. | [optional] [one of: 1, 2] +**token** | **string** | The Insert API key from the Account page of your New Relic account. Required. | [optional] +**region** | **string** | The region to which to stream logs. | [optional] [one of: 'US', 'EU'] [defaults to 'US'] +**url** | **string** | (Optional) URL of the New Relic Trace Observer, if you are using New Relic Infinite Tracing. | [optional] [defaults to 'null'] + +### Return type + +[**\Fastly\Model\LoggingNewrelicotlpResponse**](../Model/LoggingNewrelicotlpResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) + +## `deleteLogNewrelicotlp()` + +```php +deleteLogNewrelicotlp($options): \Fastly\Model\InlineResponse200 // Delete a New Relic OTLP endpoint +``` + +Delete the New Relic OTLP logging object for a particular service and version. + +### Example +```php + $options['service_id'] = 'service_id_example'; // string | Alphanumeric string identifying the service. +$options['version_id'] = 56; // int | Integer identifying a service version. +$options['logging_newrelicotlp_name'] = 'logging_newrelicotlp_name_example'; // string | The name for the real-time logging configuration. + +try { + $result = $apiInstance->deleteLogNewrelicotlp($options); +} catch (Exception $e) { + echo 'Exception when calling LoggingNewrelicotlpApi->deleteLogNewrelicotlp: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**service_id** | **string** | Alphanumeric string identifying the service. | +**version_id** | **int** | Integer identifying a service version. | +**logging_newrelicotlp_name** | **string** | The name for the real-time logging configuration. | + +### Return type + +[**\Fastly\Model\InlineResponse200**](../Model/InlineResponse200.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) + +## `getLogNewrelicotlp()` + +```php +getLogNewrelicotlp($options): \Fastly\Model\LoggingNewrelicotlpResponse // Get a New Relic OTLP endpoint +``` + +Get the details of a New Relic OTLP logging object for a particular service and version. + +### Example +```php + $options['service_id'] = 'service_id_example'; // string | Alphanumeric string identifying the service. +$options['version_id'] = 56; // int | Integer identifying a service version. +$options['logging_newrelicotlp_name'] = 'logging_newrelicotlp_name_example'; // string | The name for the real-time logging configuration. + +try { + $result = $apiInstance->getLogNewrelicotlp($options); +} catch (Exception $e) { + echo 'Exception when calling LoggingNewrelicotlpApi->getLogNewrelicotlp: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**service_id** | **string** | Alphanumeric string identifying the service. | +**version_id** | **int** | Integer identifying a service version. | +**logging_newrelicotlp_name** | **string** | The name for the real-time logging configuration. | + +### Return type + +[**\Fastly\Model\LoggingNewrelicotlpResponse**](../Model/LoggingNewrelicotlpResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) + +## `listLogNewrelicotlp()` + +```php +listLogNewrelicotlp($options): \Fastly\Model\LoggingNewrelicotlpResponse[] // List New Relic OTLP endpoints +``` + +List all of the New Relic OTLP logging objects for a particular service and version. + +### Example +```php + $options['service_id'] = 'service_id_example'; // string | Alphanumeric string identifying the service. +$options['version_id'] = 56; // int | Integer identifying a service version. + +try { + $result = $apiInstance->listLogNewrelicotlp($options); +} catch (Exception $e) { + echo 'Exception when calling LoggingNewrelicotlpApi->listLogNewrelicotlp: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**service_id** | **string** | Alphanumeric string identifying the service. | +**version_id** | **int** | Integer identifying a service version. | + +### Return type + +[**\Fastly\Model\LoggingNewrelicotlpResponse[]**](../Model/LoggingNewrelicotlpResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) + +## `updateLogNewrelicotlp()` + +```php +updateLogNewrelicotlp($options): \Fastly\Model\LoggingNewrelicotlpResponse // Update a New Relic log endpoint +``` + +Update a New Relic OTLP logging object for a particular service and version. + +### Example +```php + $options['service_id'] = 'service_id_example'; // string | Alphanumeric string identifying the service. +$options['version_id'] = 56; // int | Integer identifying a service version. +$options['logging_newrelicotlp_name'] = 'logging_newrelicotlp_name_example'; // string | The name for the real-time logging configuration. +$options['name'] = 'name_example'; // string | The name for the real-time logging configuration. +$options['placement'] = 'placement_example'; // string | Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. +$options['response_condition'] = 'response_condition_example'; // string | The name of an existing condition in the configured endpoint, or leave blank to always execute. +$options['format'] = '{\"timestamp\":\"%{begin:%Y-%m-%dT%H:%M:%S}t\",\"time_elapsed\":\"%{time.elapsed.usec}V\",\"is_tls\":\"%{if(req.is_ssl, \\\"true\\\", \\\"false\\\")}V\",\"client_ip\":\"%{req.http.Fastly-Client-IP}V\",\"geo_city\":\"%{client.geo.city}V\",\"geo_country_code\":\"%{client.geo.country_code}V\",\"request\":\"%{req.request}V\",\"host\":\"%{req.http.Fastly-Orig-Host}V\",\"url\":\"%{json.escape(req.url)}V\",\"request_referer\":\"%{json.escape(req.http.Referer)}V\",\"request_user_agent\":\"%{json.escape(req.http.User-Agent)}V\",\"request_accept_language\":\"%{json.escape(req.http.Accept-Language)}V\",\"request_accept_charset\":\"%{json.escape(req.http.Accept-Charset)}V\",\"cache_status\":\"%{regsub(fastly_info.state, \\\"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\\\", \\\"\\\\2\\\\3\\\") }V\"}'; // string | A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). +$options['format_version'] = self::FORMAT_VERSION_v2; // int | The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. +$options['token'] = 'token_example'; // string | The Insert API key from the Account page of your New Relic account. Required. +$options['region'] = 'US'; // string | The region to which to stream logs. +$options['url'] = 'null'; // string | (Optional) URL of the New Relic Trace Observer, if you are using New Relic Infinite Tracing. + +try { + $result = $apiInstance->updateLogNewrelicotlp($options); +} catch (Exception $e) { + echo 'Exception when calling LoggingNewrelicotlpApi->updateLogNewrelicotlp: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**service_id** | **string** | Alphanumeric string identifying the service. | +**version_id** | **int** | Integer identifying a service version. | +**logging_newrelicotlp_name** | **string** | The name for the real-time logging configuration. | +**name** | **string** | The name for the real-time logging configuration. | [optional] +**placement** | **string** | Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. | [optional] [one of: 'none', 'waf_debug', 'null'] +**response_condition** | **string** | The name of an existing condition in the configured endpoint, or leave blank to always execute. | [optional] +**format** | **string** | A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). | [optional] [defaults to '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}'] +**format_version** | **int** | The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. | [optional] [one of: 1, 2] +**token** | **string** | The Insert API key from the Account page of your New Relic account. Required. | [optional] +**region** | **string** | The region to which to stream logs. | [optional] [one of: 'US', 'EU'] [defaults to 'US'] +**url** | **string** | (Optional) URL of the New Relic Trace Observer, if you are using New Relic Infinite Tracing. | [optional] [defaults to 'null'] + +### Return type + +[**\Fastly\Model\LoggingNewrelicotlpResponse**](../Model/LoggingNewrelicotlpResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) diff --git a/docs/Api/RateLimiterApi.md b/docs/Api/RateLimiterApi.md index aed99c54..28726b13 100644 --- a/docs/Api/RateLimiterApi.md +++ b/docs/Api/RateLimiterApi.md @@ -69,7 +69,7 @@ Name | Type | Description | Notes **penalty_box_duration** | **int** | Length of time in minutes that the rate limiter is in effect after the initial violation is detected. | [optional] **action** | **string** | The action to take when a rate limiter violation is detected. | [optional] [one of: 'response', 'response_object', 'log_only'] **response_object_name** | **string** | Name of existing response object. Required if `action` is `response_object`. Note that the rate limiter response is only updated to reflect the response object content when saving the rate limiter configuration. | [optional] -**logger_type** | **string** | Name of the type of logging endpoint to be used when action is `log_only`. The logging endpoint type is used to determine the appropriate log format to use when emitting log entries. | [optional] [one of: 'azureblob', 'bigquery', 'cloudfiles', 'datadog', 'digitalocean', 'elasticsearch', 'ftp', 'gcs', 'googleanalytics', 'heroku', 'honeycomb', 'http', 'https', 'kafka', 'kinesis', 'logentries', 'loggly', 'logshuttle', 'newrelic', 'openstack', 'papertrail', 'pubsub', 's3', 'scalyr', 'sftp', 'splunk', 'stackdriver', 'sumologic', 'syslog'] +**logger_type** | **string** | Name of the type of logging endpoint to be used when action is `log_only`. The logging endpoint type is used to determine the appropriate log format to use when emitting log entries. | [optional] [one of: 'azureblob', 'bigquery', 'cloudfiles', 'datadog', 'digitalocean', 'elasticsearch', 'ftp', 'gcs', 'googleanalytics', 'heroku', 'honeycomb', 'http', 'https', 'kafka', 'kinesis', 'logentries', 'loggly', 'logshuttle', 'newrelic', 'newrelicotlp', 'openstack', 'papertrail', 'pubsub', 's3', 'scalyr', 'sftp', 'splunk', 'stackdriver', 'sumologic', 'syslog'] **feature_revision** | **int** | Revision number of the rate limiting feature implementation. Defaults to the most recent revision. | [optional] ### Return type @@ -229,7 +229,7 @@ Name | Type | Description | Notes **penalty_box_duration** | **int** | Length of time in minutes that the rate limiter is in effect after the initial violation is detected. | [optional] **action** | **string** | The action to take when a rate limiter violation is detected. | [optional] [one of: 'response', 'response_object', 'log_only'] **response_object_name** | **string** | Name of existing response object. Required if `action` is `response_object`. Note that the rate limiter response is only updated to reflect the response object content when saving the rate limiter configuration. | [optional] -**logger_type** | **string** | Name of the type of logging endpoint to be used when action is `log_only`. The logging endpoint type is used to determine the appropriate log format to use when emitting log entries. | [optional] [one of: 'azureblob', 'bigquery', 'cloudfiles', 'datadog', 'digitalocean', 'elasticsearch', 'ftp', 'gcs', 'googleanalytics', 'heroku', 'honeycomb', 'http', 'https', 'kafka', 'kinesis', 'logentries', 'loggly', 'logshuttle', 'newrelic', 'openstack', 'papertrail', 'pubsub', 's3', 'scalyr', 'sftp', 'splunk', 'stackdriver', 'sumologic', 'syslog'] +**logger_type** | **string** | Name of the type of logging endpoint to be used when action is `log_only`. The logging endpoint type is used to determine the appropriate log format to use when emitting log entries. | [optional] [one of: 'azureblob', 'bigquery', 'cloudfiles', 'datadog', 'digitalocean', 'elasticsearch', 'ftp', 'gcs', 'googleanalytics', 'heroku', 'honeycomb', 'http', 'https', 'kafka', 'kinesis', 'logentries', 'loggly', 'logshuttle', 'newrelic', 'newrelicotlp', 'openstack', 'papertrail', 'pubsub', 's3', 'scalyr', 'sftp', 'splunk', 'stackdriver', 'sumologic', 'syslog'] **feature_revision** | **int** | Revision number of the rate limiting feature implementation. Defaults to the most recent revision. | [optional] ### Return type diff --git a/docs/Api/SecretStoreApi.md b/docs/Api/SecretStoreApi.md index 7afc4791..106d2709 100644 --- a/docs/Api/SecretStoreApi.md +++ b/docs/Api/SecretStoreApi.md @@ -17,7 +17,7 @@ Method | Fastly API endpoint | Description [**clientKey()**](SecretStoreApi.md#clientKey) | **POST** /resources/stores/secret/client-key | Create new client key [**createSecretStore()**](SecretStoreApi.md#createSecretStore) | **POST** /resources/stores/secret | Create new secret store [**deleteSecretStore()**](SecretStoreApi.md#deleteSecretStore) | **DELETE** /resources/stores/secret/{store_id} | Delete secret store -[**getSecretStore()**](SecretStoreApi.md#getSecretStore) | **GET** /resources/stores/secret/{store_id} | Create secret store by ID +[**getSecretStore()**](SecretStoreApi.md#getSecretStore) | **GET** /resources/stores/secret/{store_id} | Get secret store by ID [**getSecretStores()**](SecretStoreApi.md#getSecretStores) | **GET** /resources/stores/secret | Get all secret stores [**signingKey()**](SecretStoreApi.md#signingKey) | **GET** /resources/stores/secret/signing-key | Get public key @@ -124,7 +124,7 @@ void (empty response body) ## `getSecretStore()` ```php -getSecretStore($options): \Fastly\Model\SecretStoreResponse // Create secret store by ID +getSecretStore($options): \Fastly\Model\SecretStoreResponse // Get secret store by ID ``` Get a secret store by ID. diff --git a/docs/Api/TlsDomainsApi.md b/docs/Api/TlsDomainsApi.md index be2f1161..26b9591c 100644 --- a/docs/Api/TlsDomainsApi.md +++ b/docs/Api/TlsDomainsApi.md @@ -30,7 +30,7 @@ List all TLS domains. $options['filter_in_use'] = 'filter_in_use_example'; // string | Optional. Limit the returned domains to those currently using Fastly to terminate TLS with SNI (that is, domains considered \"in use\") Permitted values: true, false. $options['filter_tls_certificates_id'] = 'filter_tls_certificates_id_example'; // string | Optional. Limit the returned domains to those listed in the given TLS certificate's SAN list. $options['filter_tls_subscriptions_id'] = 'filter_tls_subscriptions_id_example'; // string | Optional. Limit the returned domains to those for a given TLS subscription. -$options['include'] = 'include_example'; // string | Include related objects. Optional, comma-separated values. Permitted values: `tls_activations`, `tls_certificates`, `tls_subscriptions`, `tls_subscriptions.tls_authorizations`, and `tls_authorizations.globalsign_email_challenge`. +$options['include'] = 'include_example'; // string | Include related objects. Optional, comma-separated values. Permitted values: `tls_activations`, `tls_certificates`, `tls_subscriptions`, `tls_subscriptions.tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. $options['page_number'] = 1; // int | Current page. $options['page_size'] = 20; // int | Number of records per page. $options['sort'] = created_at; // string | The order in which to list the results by creation date. @@ -51,7 +51,7 @@ Name | Type | Description | Notes **filter_in_use** | **string** | Optional. Limit the returned domains to those currently using Fastly to terminate TLS with SNI (that is, domains considered \"in use\") Permitted values: true, false. | [optional] **filter_tls_certificates_id** | **string** | Optional. Limit the returned domains to those listed in the given TLS certificate's SAN list. | [optional] **filter_tls_subscriptions_id** | **string** | Optional. Limit the returned domains to those for a given TLS subscription. | [optional] -**include** | **string** | Include related objects. Optional, comma-separated values. Permitted values: `tls_activations`, `tls_certificates`, `tls_subscriptions`, `tls_subscriptions.tls_authorizations`, and `tls_authorizations.globalsign_email_challenge`. | [optional] +**include** | **string** | Include related objects. Optional, comma-separated values. Permitted values: `tls_activations`, `tls_certificates`, `tls_subscriptions`, `tls_subscriptions.tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. | [optional] **page_number** | **int** | Current page. | [optional] **page_size** | **int** | Number of records per page. | [optional] [defaults to 20] **sort** | **string** | The order in which to list the results by creation date. | [optional] [one of: 'created_at', '-created_at'] [defaults to 'created_at'] diff --git a/docs/Api/TlsSubscriptionsApi.md b/docs/Api/TlsSubscriptionsApi.md index 4185926b..a00ed540 100644 --- a/docs/Api/TlsSubscriptionsApi.md +++ b/docs/Api/TlsSubscriptionsApi.md @@ -179,7 +179,7 @@ Show a TLS subscription. ### Example ```php - $options['include'] = tls_authorizations; // string | Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations` and `tls_authorizations.globalsign_email_challenge`. + $options['include'] = tls_authorizations; // string | Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. $options['tls_subscription_id'] = 'tls_subscription_id_example'; // string | Alphanumeric string identifying a TLS subscription. try { @@ -195,7 +195,7 @@ Note: the input parameter is an associative array with the keys listed below. Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**include** | **string** | Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations` and `tls_authorizations.globalsign_email_challenge`. | [optional] +**include** | **string** | Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. | [optional] **tls_subscription_id** | **string** | Alphanumeric string identifying a TLS subscription. | ### Return type @@ -218,7 +218,7 @@ List all TLS subscriptions. $options['filter_state'] = 'filter_state_example'; // string | Limit the returned subscriptions by state. Valid values are `pending`, `processing`, `issued`, `renewing`, and `failed`. Accepts parameters: `not` (e.g., `filter[state][not]=renewing`). $options['filter_tls_domains_id'] = 'filter_tls_domains_id_example'; // string | Limit the returned subscriptions to those that include the specific domain. $options['filter_has_active_order'] = True; // bool | Limit the returned subscriptions to those that have currently active orders. Permitted values: `true`. -$options['include'] = tls_authorizations; // string | Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations` and `tls_authorizations.globalsign_email_challenge`. +$options['include'] = tls_authorizations; // string | Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. $options['page_number'] = 1; // int | Current page. $options['page_size'] = 20; // int | Number of records per page. $options['sort'] = created_at; // string | The order in which to list the results by creation date. @@ -239,7 +239,7 @@ Name | Type | Description | Notes **filter_state** | **string** | Limit the returned subscriptions by state. Valid values are `pending`, `processing`, `issued`, `renewing`, and `failed`. Accepts parameters: `not` (e.g., `filter[state][not]=renewing`). | [optional] **filter_tls_domains_id** | **string** | Limit the returned subscriptions to those that include the specific domain. | [optional] **filter_has_active_order** | **bool** | Limit the returned subscriptions to those that have currently active orders. Permitted values: `true`. | [optional] -**include** | **string** | Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations` and `tls_authorizations.globalsign_email_challenge`. | [optional] +**include** | **string** | Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. | [optional] **page_number** | **int** | Current page. | [optional] **page_size** | **int** | Number of records per page. | [optional] [defaults to 20] **sort** | **string** | The order in which to list the results by creation date. | [optional] [one of: 'created_at', '-created_at'] [defaults to 'created_at'] diff --git a/docs/Model/Backend.md b/docs/Model/Backend.md index 473d725e..ae2a5177 100644 --- a/docs/Model/Backend.md +++ b/docs/Model/Backend.md @@ -23,6 +23,7 @@ Name | Type | Description | Notes **override_host** | **string** | If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL. | [optional] **port** | **int** | Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request. | [optional] **request_condition** | **string** | Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests. | [optional] +**share_key** | **string** | Value that when shared across backends will enable those backends to share the same health check. | [optional] **shield** | **string** | Identifier of the POP to use as a [shield](https://docs.fastly.com/en/guides/shielding). | [optional] **ssl_ca_cert** | **string** | CA certificate attached to origin. | [optional] **ssl_cert_hostname** | **string** | Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all. | [optional] diff --git a/docs/Model/BackendResponse.md b/docs/Model/BackendResponse.md index bf3f4fa7..ff5e44c9 100644 --- a/docs/Model/BackendResponse.md +++ b/docs/Model/BackendResponse.md @@ -23,6 +23,7 @@ Name | Type | Description | Notes **override_host** | **string** | If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL. | [optional] **port** | **int** | Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request. | [optional] **request_condition** | **string** | Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests. | [optional] +**share_key** | **string** | Value that when shared across backends will enable those backends to share the same health check. | [optional] **shield** | **string** | Identifier of the POP to use as a [shield](https://docs.fastly.com/en/guides/shielding). | [optional] **ssl_ca_cert** | **string** | CA certificate attached to origin. | [optional] **ssl_cert_hostname** | **string** | Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all. | [optional] diff --git a/docs/Model/LoggingNewrelicotlpAdditional.md b/docs/Model/LoggingNewrelicotlpAdditional.md new file mode 100644 index 00000000..121f0846 --- /dev/null +++ b/docs/Model/LoggingNewrelicotlpAdditional.md @@ -0,0 +1,13 @@ +# # LoggingNewrelicotlpAdditional + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**format** | **string** | A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). | [optional] [defaults to '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}'] +**token** | **string** | The Insert API key from the Account page of your New Relic account. Required. | [optional] +**region** | **string** | The region to which to stream logs. | [optional] [one of: 'US', 'EU'] [defaults to 'US'] +**url** | **string** | (Optional) URL of the New Relic Trace Observer, if you are using New Relic Infinite Tracing. | [optional] [defaults to 'null'] + + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoggingNewrelicotlpResponse.md b/docs/Model/LoggingNewrelicotlpResponse.md new file mode 100644 index 00000000..5a6eda15 --- /dev/null +++ b/docs/Model/LoggingNewrelicotlpResponse.md @@ -0,0 +1,22 @@ +# # LoggingNewrelicotlpResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | The name for the real-time logging configuration. | [optional] +**placement** | **string** | Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. | [optional] [one of: 'none', 'waf_debug', 'null'] +**response_condition** | **string** | The name of an existing condition in the configured endpoint, or leave blank to always execute. | [optional] +**format** | **string** | A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). | [optional] [defaults to '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}'] +**format_version** | **string** | The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. | [optional] [one of: '1', '2'] [defaults to '2'] +**token** | **string** | The Insert API key from the Account page of your New Relic account. Required. | [optional] +**region** | **string** | The region to which to stream logs. | [optional] [one of: 'US', 'EU'] [defaults to 'US'] +**url** | **string** | (Optional) URL of the New Relic Trace Observer, if you are using New Relic Infinite Tracing. | [optional] [defaults to 'null'] +**created_at** | **\DateTime** | Date and time in ISO 8601 format. | [optional] [readonly] +**deleted_at** | **\DateTime** | Date and time in ISO 8601 format. | [optional] [readonly] +**updated_at** | **\DateTime** | Date and time in ISO 8601 format. | [optional] [readonly] +**service_id** | **string** | | [optional] [readonly] +**version** | **string** | | [optional] [readonly] + + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RateLimiter.md b/docs/Model/RateLimiter.md index 6b2da65c..91078570 100644 --- a/docs/Model/RateLimiter.md +++ b/docs/Model/RateLimiter.md @@ -14,7 +14,7 @@ Name | Type | Description | Notes **action** | **string** | The action to take when a rate limiter violation is detected. | [optional] [one of: 'response', 'response_object', 'log_only'] **response** | **array<string,string>** | Custom response to be sent when the rate limit is exceeded. Required if `action` is `response`. | [optional] **response_object_name** | **string** | Name of existing response object. Required if `action` is `response_object`. Note that the rate limiter response is only updated to reflect the response object content when saving the rate limiter configuration. | [optional] -**logger_type** | **string** | Name of the type of logging endpoint to be used when action is `log_only`. The logging endpoint type is used to determine the appropriate log format to use when emitting log entries. | [optional] [one of: 'azureblob', 'bigquery', 'cloudfiles', 'datadog', 'digitalocean', 'elasticsearch', 'ftp', 'gcs', 'googleanalytics', 'heroku', 'honeycomb', 'http', 'https', 'kafka', 'kinesis', 'logentries', 'loggly', 'logshuttle', 'newrelic', 'openstack', 'papertrail', 'pubsub', 's3', 'scalyr', 'sftp', 'splunk', 'stackdriver', 'sumologic', 'syslog'] +**logger_type** | **string** | Name of the type of logging endpoint to be used when action is `log_only`. The logging endpoint type is used to determine the appropriate log format to use when emitting log entries. | [optional] [one of: 'azureblob', 'bigquery', 'cloudfiles', 'datadog', 'digitalocean', 'elasticsearch', 'ftp', 'gcs', 'googleanalytics', 'heroku', 'honeycomb', 'http', 'https', 'kafka', 'kinesis', 'logentries', 'loggly', 'logshuttle', 'newrelic', 'newrelicotlp', 'openstack', 'papertrail', 'pubsub', 's3', 'scalyr', 'sftp', 'splunk', 'stackdriver', 'sumologic', 'syslog'] **feature_revision** | **int** | Revision number of the rate limiting feature implementation. Defaults to the most recent revision. | [optional] diff --git a/docs/Model/RateLimiterResponse.md b/docs/Model/RateLimiterResponse.md index 16e61c64..d33e8b2b 100644 --- a/docs/Model/RateLimiterResponse.md +++ b/docs/Model/RateLimiterResponse.md @@ -14,7 +14,7 @@ Name | Type | Description | Notes **action** | **string** | The action to take when a rate limiter violation is detected. | [optional] [one of: 'response', 'response_object', 'log_only'] **response** | **array<string,string>** | Custom response to be sent when the rate limit is exceeded. Required if `action` is `response`. | [optional] **response_object_name** | **string** | Name of existing response object. Required if `action` is `response_object`. Note that the rate limiter response is only updated to reflect the response object content when saving the rate limiter configuration. | [optional] -**logger_type** | **string** | Name of the type of logging endpoint to be used when action is `log_only`. The logging endpoint type is used to determine the appropriate log format to use when emitting log entries. | [optional] [one of: 'azureblob', 'bigquery', 'cloudfiles', 'datadog', 'digitalocean', 'elasticsearch', 'ftp', 'gcs', 'googleanalytics', 'heroku', 'honeycomb', 'http', 'https', 'kafka', 'kinesis', 'logentries', 'loggly', 'logshuttle', 'newrelic', 'openstack', 'papertrail', 'pubsub', 's3', 'scalyr', 'sftp', 'splunk', 'stackdriver', 'sumologic', 'syslog'] +**logger_type** | **string** | Name of the type of logging endpoint to be used when action is `log_only`. The logging endpoint type is used to determine the appropriate log format to use when emitting log entries. | [optional] [one of: 'azureblob', 'bigquery', 'cloudfiles', 'datadog', 'digitalocean', 'elasticsearch', 'ftp', 'gcs', 'googleanalytics', 'heroku', 'honeycomb', 'http', 'https', 'kafka', 'kinesis', 'logentries', 'loggly', 'logshuttle', 'newrelic', 'newrelicotlp', 'openstack', 'papertrail', 'pubsub', 's3', 'scalyr', 'sftp', 'splunk', 'stackdriver', 'sumologic', 'syslog'] **feature_revision** | **int** | Revision number of the rate limiting feature implementation. Defaults to the most recent revision. | [optional] **service_id** | **string** | | [optional] [readonly] **version** | **int** | | [optional] [readonly] diff --git a/lib/Api/BackendApi.php b/lib/Api/BackendApi.php index 9ccab07e..79910cec 100644 --- a/lib/Api/BackendApi.php +++ b/lib/Api/BackendApi.php @@ -140,6 +140,7 @@ public function getConfig() * @param string $override_host If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL. (optional) * @param int $port Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request. (optional) * @param string $request_condition Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests. (optional) + * @param string $share_key Value that when shared across backends will enable those backends to share the same health check. (optional) * @param string $shield Identifier of the POP to use as a [shield](https://docs.fastly.com/en/guides/shielding). (optional) * @param string $ssl_ca_cert CA certificate attached to origin. (optional) * @param string $ssl_cert_hostname Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all. (optional) @@ -193,6 +194,7 @@ public function createBackend($options) * @param string $override_host If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL. (optional) * @param int $port Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request. (optional) * @param string $request_condition Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests. (optional) + * @param string $share_key Value that when shared across backends will enable those backends to share the same health check. (optional) * @param string $shield Identifier of the POP to use as a [shield](https://docs.fastly.com/en/guides/shielding). (optional) * @param string $ssl_ca_cert CA certificate attached to origin. (optional) * @param string $ssl_cert_hostname Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all. (optional) @@ -334,6 +336,7 @@ public function createBackendWithHttpInfo($options) * @param string $override_host If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL. (optional) * @param int $port Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request. (optional) * @param string $request_condition Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests. (optional) + * @param string $share_key Value that when shared across backends will enable those backends to share the same health check. (optional) * @param string $shield Identifier of the POP to use as a [shield](https://docs.fastly.com/en/guides/shielding). (optional) * @param string $ssl_ca_cert CA certificate attached to origin. (optional) * @param string $ssl_cert_hostname Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all. (optional) @@ -390,6 +393,7 @@ function ($response) { * @param string $override_host If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL. (optional) * @param int $port Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request. (optional) * @param string $request_condition Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests. (optional) + * @param string $share_key Value that when shared across backends will enable those backends to share the same health check. (optional) * @param string $shield Identifier of the POP to use as a [shield](https://docs.fastly.com/en/guides/shielding). (optional) * @param string $ssl_ca_cert CA certificate attached to origin. (optional) * @param string $ssl_cert_hostname Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all. (optional) @@ -472,6 +476,7 @@ function ($exception) { * @param string $override_host If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL. (optional) * @param int $port Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request. (optional) * @param string $request_condition Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests. (optional) + * @param string $share_key Value that when shared across backends will enable those backends to share the same health check. (optional) * @param string $shield Identifier of the POP to use as a [shield](https://docs.fastly.com/en/guides/shielding). (optional) * @param string $ssl_ca_cert CA certificate attached to origin. (optional) * @param string $ssl_cert_hostname Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all. (optional) @@ -511,6 +516,7 @@ public function createBackendRequest($options) $override_host = array_key_exists('override_host', $options) ? $options['override_host'] : null; $port = array_key_exists('port', $options) ? $options['port'] : null; $request_condition = array_key_exists('request_condition', $options) ? $options['request_condition'] : null; + $share_key = array_key_exists('share_key', $options) ? $options['share_key'] : null; $shield = array_key_exists('shield', $options) ? $options['shield'] : null; $ssl_ca_cert = array_key_exists('ssl_ca_cert', $options) ? $options['ssl_ca_cert'] : null; $ssl_cert_hostname = array_key_exists('ssl_cert_hostname', $options) ? $options['ssl_cert_hostname'] : null; @@ -535,6 +541,10 @@ public function createBackendRequest($options) 'Missing the required parameter $version_id when calling createBackend' ); } + if ($share_key !== null && !preg_match("/^[A-Za-z0-9]+$/", $share_key)) { + throw new \InvalidArgumentException("invalid value for \"share_key\" when calling BackendApi.createBackend, must conform to the pattern /^[A-Za-z0-9]+$/."); + } + $resourcePath = '/service/{service_id}/version/{version_id}/backend'; $formParams = []; @@ -639,6 +649,10 @@ public function createBackendRequest($options) $formParams['request_condition'] = ObjectSerializer::toFormValue($request_condition); } // form params + if ($share_key !== null) { + $formParams['share_key'] = ObjectSerializer::toFormValue($share_key); + } + // form params if ($shield !== null) { $formParams['shield'] = ObjectSerializer::toFormValue($shield); } @@ -1849,6 +1863,7 @@ public function listBackendsRequest($options) * @param string $override_host If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL. (optional) * @param int $port Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request. (optional) * @param string $request_condition Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests. (optional) + * @param string $share_key Value that when shared across backends will enable those backends to share the same health check. (optional) * @param string $shield Identifier of the POP to use as a [shield](https://docs.fastly.com/en/guides/shielding). (optional) * @param string $ssl_ca_cert CA certificate attached to origin. (optional) * @param string $ssl_cert_hostname Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all. (optional) @@ -1903,6 +1918,7 @@ public function updateBackend($options) * @param string $override_host If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL. (optional) * @param int $port Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request. (optional) * @param string $request_condition Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests. (optional) + * @param string $share_key Value that when shared across backends will enable those backends to share the same health check. (optional) * @param string $shield Identifier of the POP to use as a [shield](https://docs.fastly.com/en/guides/shielding). (optional) * @param string $ssl_ca_cert CA certificate attached to origin. (optional) * @param string $ssl_cert_hostname Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all. (optional) @@ -2045,6 +2061,7 @@ public function updateBackendWithHttpInfo($options) * @param string $override_host If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL. (optional) * @param int $port Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request. (optional) * @param string $request_condition Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests. (optional) + * @param string $share_key Value that when shared across backends will enable those backends to share the same health check. (optional) * @param string $shield Identifier of the POP to use as a [shield](https://docs.fastly.com/en/guides/shielding). (optional) * @param string $ssl_ca_cert CA certificate attached to origin. (optional) * @param string $ssl_cert_hostname Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all. (optional) @@ -2102,6 +2119,7 @@ function ($response) { * @param string $override_host If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL. (optional) * @param int $port Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request. (optional) * @param string $request_condition Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests. (optional) + * @param string $share_key Value that when shared across backends will enable those backends to share the same health check. (optional) * @param string $shield Identifier of the POP to use as a [shield](https://docs.fastly.com/en/guides/shielding). (optional) * @param string $ssl_ca_cert CA certificate attached to origin. (optional) * @param string $ssl_cert_hostname Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all. (optional) @@ -2185,6 +2203,7 @@ function ($exception) { * @param string $override_host If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL. (optional) * @param int $port Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request. (optional) * @param string $request_condition Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests. (optional) + * @param string $share_key Value that when shared across backends will enable those backends to share the same health check. (optional) * @param string $shield Identifier of the POP to use as a [shield](https://docs.fastly.com/en/guides/shielding). (optional) * @param string $ssl_ca_cert CA certificate attached to origin. (optional) * @param string $ssl_cert_hostname Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all. (optional) @@ -2225,6 +2244,7 @@ public function updateBackendRequest($options) $override_host = array_key_exists('override_host', $options) ? $options['override_host'] : null; $port = array_key_exists('port', $options) ? $options['port'] : null; $request_condition = array_key_exists('request_condition', $options) ? $options['request_condition'] : null; + $share_key = array_key_exists('share_key', $options) ? $options['share_key'] : null; $shield = array_key_exists('shield', $options) ? $options['shield'] : null; $ssl_ca_cert = array_key_exists('ssl_ca_cert', $options) ? $options['ssl_ca_cert'] : null; $ssl_cert_hostname = array_key_exists('ssl_cert_hostname', $options) ? $options['ssl_cert_hostname'] : null; @@ -2255,6 +2275,10 @@ public function updateBackendRequest($options) 'Missing the required parameter $backend_name when calling updateBackend' ); } + if ($share_key !== null && !preg_match("/^[A-Za-z0-9]+$/", $share_key)) { + throw new \InvalidArgumentException("invalid value for \"share_key\" when calling BackendApi.updateBackend, must conform to the pattern /^[A-Za-z0-9]+$/."); + } + $resourcePath = '/service/{service_id}/version/{version_id}/backend/{backend_name}'; $formParams = []; @@ -2367,6 +2391,10 @@ public function updateBackendRequest($options) $formParams['request_condition'] = ObjectSerializer::toFormValue($request_condition); } // form params + if ($share_key !== null) { + $formParams['share_key'] = ObjectSerializer::toFormValue($share_key); + } + // form params if ($shield !== null) { $formParams['shield'] = ObjectSerializer::toFormValue($shield); } diff --git a/lib/Api/LoggingNewrelicotlpApi.php b/lib/Api/LoggingNewrelicotlpApi.php new file mode 100644 index 00000000..8bf62826 --- /dev/null +++ b/lib/Api/LoggingNewrelicotlpApi.php @@ -0,0 +1,2060 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createLogNewrelicotlp + * + * Create a New Relic OTLP endpoint + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $name The name for the real-time logging configuration. (optional) + * @param string $placement Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. (optional) + * @param string $response_condition The name of an existing condition in the configured endpoint, or leave blank to always execute. (optional) + * @param string $format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). (optional, default to '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}') + * @param int $format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. (optional, default to self::FORMAT_VERSION_v2) + * @param string $token The Insert API key from the Account page of your New Relic account. Required. (optional) + * @param string $region The region to which to stream logs. (optional, default to 'US') + * @param string $url (Optional) URL of the New Relic Trace Observer, if you are using New Relic Infinite Tracing. (optional, default to 'null') + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Fastly\Model\LoggingNewrelicotlpResponse + */ + public function createLogNewrelicotlp($options) + { + list($response) = $this->createLogNewrelicotlpWithHttpInfo($options); + return $response; + } + + /** + * Operation createLogNewrelicotlpWithHttpInfo + * + * Create a New Relic OTLP endpoint + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains Fastly API host(s). Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $name The name for the real-time logging configuration. (optional) + * @param string $placement Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. (optional) + * @param string $response_condition The name of an existing condition in the configured endpoint, or leave blank to always execute. (optional) + * @param string $format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). (optional, default to '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}') + * @param int $format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. (optional, default to self::FORMAT_VERSION_v2) + * @param string $token The Insert API key from the Account page of your New Relic account. Required. (optional) + * @param string $region The region to which to stream logs. (optional, default to 'US') + * @param string $url (Optional) URL of the New Relic Trace Observer, if you are using New Relic Infinite Tracing. (optional, default to 'null') + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Fastly\Model\LoggingNewrelicotlpResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createLogNewrelicotlpWithHttpInfo($options) + { + $request = $this->createLogNewrelicotlpRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('POST' != 'GET' && 'POST' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Fastly\Model\LoggingNewrelicotlpResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\LoggingNewrelicotlpResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\LoggingNewrelicotlpResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Fastly\Model\LoggingNewrelicotlpResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createLogNewrelicotlpAsync + * + * Create a New Relic OTLP endpoint + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $name The name for the real-time logging configuration. (optional) + * @param string $placement Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. (optional) + * @param string $response_condition The name of an existing condition in the configured endpoint, or leave blank to always execute. (optional) + * @param string $format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). (optional, default to '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}') + * @param int $format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. (optional, default to self::FORMAT_VERSION_v2) + * @param string $token The Insert API key from the Account page of your New Relic account. Required. (optional) + * @param string $region The region to which to stream logs. (optional, default to 'US') + * @param string $url (Optional) URL of the New Relic Trace Observer, if you are using New Relic Infinite Tracing. (optional, default to 'null') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createLogNewrelicotlpAsync($options) + { + return $this->createLogNewrelicotlpAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createLogNewrelicotlpAsyncWithHttpInfo + * + * Create a New Relic OTLP endpoint + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $name The name for the real-time logging configuration. (optional) + * @param string $placement Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. (optional) + * @param string $response_condition The name of an existing condition in the configured endpoint, or leave blank to always execute. (optional) + * @param string $format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). (optional, default to '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}') + * @param int $format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. (optional, default to self::FORMAT_VERSION_v2) + * @param string $token The Insert API key from the Account page of your New Relic account. Required. (optional) + * @param string $region The region to which to stream logs. (optional, default to 'US') + * @param string $url (Optional) URL of the New Relic Trace Observer, if you are using New Relic Infinite Tracing. (optional, default to 'null') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createLogNewrelicotlpAsyncWithHttpInfo($options) + { + $returnType = '\Fastly\Model\LoggingNewrelicotlpResponse'; + $request = $this->createLogNewrelicotlpRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createLogNewrelicotlp' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $name The name for the real-time logging configuration. (optional) + * @param string $placement Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. (optional) + * @param string $response_condition The name of an existing condition in the configured endpoint, or leave blank to always execute. (optional) + * @param string $format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). (optional, default to '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}') + * @param int $format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. (optional, default to self::FORMAT_VERSION_v2) + * @param string $token The Insert API key from the Account page of your New Relic account. Required. (optional) + * @param string $region The region to which to stream logs. (optional, default to 'US') + * @param string $url (Optional) URL of the New Relic Trace Observer, if you are using New Relic Infinite Tracing. (optional, default to 'null') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createLogNewrelicotlpRequest($options) + { + // unbox the parameters from the associative array + $service_id = array_key_exists('service_id', $options) ? $options['service_id'] : null; + $version_id = array_key_exists('version_id', $options) ? $options['version_id'] : null; + $name = array_key_exists('name', $options) ? $options['name'] : null; + $placement = array_key_exists('placement', $options) ? $options['placement'] : null; + $response_condition = array_key_exists('response_condition', $options) ? $options['response_condition'] : null; + $format = array_key_exists('format', $options) ? $options['format'] : '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}'; + $format_version = array_key_exists('format_version', $options) ? $options['format_version'] : self::FORMAT_VERSION_v2; + $token = array_key_exists('token', $options) ? $options['token'] : null; + $region = array_key_exists('region', $options) ? $options['region'] : 'US'; + $url = array_key_exists('url', $options) ? $options['url'] : 'null'; + + // verify the required parameter 'service_id' is set + if ($service_id === null || (is_array($service_id) && count($service_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $service_id when calling createLogNewrelicotlp' + ); + } + // verify the required parameter 'version_id' is set + if ($version_id === null || (is_array($version_id) && count($version_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $version_id when calling createLogNewrelicotlp' + ); + } + + $resourcePath = '/service/{service_id}/version/{version_id}/logging/newrelicotlp'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($service_id !== null) { + $resourcePath = str_replace( + '{' . 'service_id' . '}', + ObjectSerializer::toPathValue($service_id), + $resourcePath + ); + } + // path params + if ($version_id !== null) { + $resourcePath = str_replace( + '{' . 'version_id' . '}', + ObjectSerializer::toPathValue($version_id), + $resourcePath + ); + } + + // form params + if ($name !== null) { + $formParams['name'] = ObjectSerializer::toFormValue($name); + } + // form params + if ($placement !== null) { + $formParams['placement'] = ObjectSerializer::toFormValue($placement); + } + // form params + if ($response_condition !== null) { + $formParams['response_condition'] = ObjectSerializer::toFormValue($response_condition); + } + // form params + if ($format !== null) { + $formParams['format'] = ObjectSerializer::toFormValue($format); + } + // form params + if ($format_version !== null) { + $formParams['format_version'] = ObjectSerializer::toFormValue($format_version); + } + // form params + if ($token !== null) { + $formParams['token'] = ObjectSerializer::toFormValue($token); + } + // form params + if ($region !== null) { + $formParams['region'] = ObjectSerializer::toFormValue($region); + } + // form params + if ($url !== null) { + $formParams['url'] = ObjectSerializer::toFormValue($url); + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/x-www-form-urlencoded'] + ); + } + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHosts = ["https://api.fastly.com"]; + if ($this->hostIndex < 0 || $this->hostIndex >= sizeof($operationHosts)) { + throw new \InvalidArgumentException("Invalid index {$this->hostIndex} when selecting the host. Must be less than ".sizeof($operationHosts)); + } + $operationHost = $operationHosts[$this->hostIndex]; + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteLogNewrelicotlp + * + * Delete a New Relic OTLP endpoint + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $logging_newrelicotlp_name The name for the real-time logging configuration. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Fastly\Model\InlineResponse200 + */ + public function deleteLogNewrelicotlp($options) + { + list($response) = $this->deleteLogNewrelicotlpWithHttpInfo($options); + return $response; + } + + /** + * Operation deleteLogNewrelicotlpWithHttpInfo + * + * Delete a New Relic OTLP endpoint + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains Fastly API host(s). Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $logging_newrelicotlp_name The name for the real-time logging configuration. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Fastly\Model\InlineResponse200, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteLogNewrelicotlpWithHttpInfo($options) + { + $request = $this->deleteLogNewrelicotlpRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('DELETE' != 'GET' && 'DELETE' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Fastly\Model\InlineResponse200' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\InlineResponse200', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\InlineResponse200'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Fastly\Model\InlineResponse200', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteLogNewrelicotlpAsync + * + * Delete a New Relic OTLP endpoint + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $logging_newrelicotlp_name The name for the real-time logging configuration. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteLogNewrelicotlpAsync($options) + { + return $this->deleteLogNewrelicotlpAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteLogNewrelicotlpAsyncWithHttpInfo + * + * Delete a New Relic OTLP endpoint + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $logging_newrelicotlp_name The name for the real-time logging configuration. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteLogNewrelicotlpAsyncWithHttpInfo($options) + { + $returnType = '\Fastly\Model\InlineResponse200'; + $request = $this->deleteLogNewrelicotlpRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteLogNewrelicotlp' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $logging_newrelicotlp_name The name for the real-time logging configuration. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteLogNewrelicotlpRequest($options) + { + // unbox the parameters from the associative array + $service_id = array_key_exists('service_id', $options) ? $options['service_id'] : null; + $version_id = array_key_exists('version_id', $options) ? $options['version_id'] : null; + $logging_newrelicotlp_name = array_key_exists('logging_newrelicotlp_name', $options) ? $options['logging_newrelicotlp_name'] : null; + + // verify the required parameter 'service_id' is set + if ($service_id === null || (is_array($service_id) && count($service_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $service_id when calling deleteLogNewrelicotlp' + ); + } + // verify the required parameter 'version_id' is set + if ($version_id === null || (is_array($version_id) && count($version_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $version_id when calling deleteLogNewrelicotlp' + ); + } + // verify the required parameter 'logging_newrelicotlp_name' is set + if ($logging_newrelicotlp_name === null || (is_array($logging_newrelicotlp_name) && count($logging_newrelicotlp_name) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $logging_newrelicotlp_name when calling deleteLogNewrelicotlp' + ); + } + + $resourcePath = '/service/{service_id}/version/{version_id}/logging/newrelicotlp/{logging_newrelicotlp_name}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($service_id !== null) { + $resourcePath = str_replace( + '{' . 'service_id' . '}', + ObjectSerializer::toPathValue($service_id), + $resourcePath + ); + } + // path params + if ($version_id !== null) { + $resourcePath = str_replace( + '{' . 'version_id' . '}', + ObjectSerializer::toPathValue($version_id), + $resourcePath + ); + } + // path params + if ($logging_newrelicotlp_name !== null) { + $resourcePath = str_replace( + '{' . 'logging_newrelicotlp_name' . '}', + ObjectSerializer::toPathValue($logging_newrelicotlp_name), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHosts = ["https://api.fastly.com"]; + if ($this->hostIndex < 0 || $this->hostIndex >= sizeof($operationHosts)) { + throw new \InvalidArgumentException("Invalid index {$this->hostIndex} when selecting the host. Must be less than ".sizeof($operationHosts)); + } + $operationHost = $operationHosts[$this->hostIndex]; + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getLogNewrelicotlp + * + * Get a New Relic OTLP endpoint + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $logging_newrelicotlp_name The name for the real-time logging configuration. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Fastly\Model\LoggingNewrelicotlpResponse + */ + public function getLogNewrelicotlp($options) + { + list($response) = $this->getLogNewrelicotlpWithHttpInfo($options); + return $response; + } + + /** + * Operation getLogNewrelicotlpWithHttpInfo + * + * Get a New Relic OTLP endpoint + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains Fastly API host(s). Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $logging_newrelicotlp_name The name for the real-time logging configuration. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Fastly\Model\LoggingNewrelicotlpResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getLogNewrelicotlpWithHttpInfo($options) + { + $request = $this->getLogNewrelicotlpRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('GET' != 'GET' && 'GET' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Fastly\Model\LoggingNewrelicotlpResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\LoggingNewrelicotlpResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\LoggingNewrelicotlpResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Fastly\Model\LoggingNewrelicotlpResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getLogNewrelicotlpAsync + * + * Get a New Relic OTLP endpoint + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $logging_newrelicotlp_name The name for the real-time logging configuration. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getLogNewrelicotlpAsync($options) + { + return $this->getLogNewrelicotlpAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getLogNewrelicotlpAsyncWithHttpInfo + * + * Get a New Relic OTLP endpoint + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $logging_newrelicotlp_name The name for the real-time logging configuration. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getLogNewrelicotlpAsyncWithHttpInfo($options) + { + $returnType = '\Fastly\Model\LoggingNewrelicotlpResponse'; + $request = $this->getLogNewrelicotlpRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getLogNewrelicotlp' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $logging_newrelicotlp_name The name for the real-time logging configuration. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getLogNewrelicotlpRequest($options) + { + // unbox the parameters from the associative array + $service_id = array_key_exists('service_id', $options) ? $options['service_id'] : null; + $version_id = array_key_exists('version_id', $options) ? $options['version_id'] : null; + $logging_newrelicotlp_name = array_key_exists('logging_newrelicotlp_name', $options) ? $options['logging_newrelicotlp_name'] : null; + + // verify the required parameter 'service_id' is set + if ($service_id === null || (is_array($service_id) && count($service_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $service_id when calling getLogNewrelicotlp' + ); + } + // verify the required parameter 'version_id' is set + if ($version_id === null || (is_array($version_id) && count($version_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $version_id when calling getLogNewrelicotlp' + ); + } + // verify the required parameter 'logging_newrelicotlp_name' is set + if ($logging_newrelicotlp_name === null || (is_array($logging_newrelicotlp_name) && count($logging_newrelicotlp_name) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $logging_newrelicotlp_name when calling getLogNewrelicotlp' + ); + } + + $resourcePath = '/service/{service_id}/version/{version_id}/logging/newrelicotlp/{logging_newrelicotlp_name}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($service_id !== null) { + $resourcePath = str_replace( + '{' . 'service_id' . '}', + ObjectSerializer::toPathValue($service_id), + $resourcePath + ); + } + // path params + if ($version_id !== null) { + $resourcePath = str_replace( + '{' . 'version_id' . '}', + ObjectSerializer::toPathValue($version_id), + $resourcePath + ); + } + // path params + if ($logging_newrelicotlp_name !== null) { + $resourcePath = str_replace( + '{' . 'logging_newrelicotlp_name' . '}', + ObjectSerializer::toPathValue($logging_newrelicotlp_name), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHosts = ["https://api.fastly.com"]; + if ($this->hostIndex < 0 || $this->hostIndex >= sizeof($operationHosts)) { + throw new \InvalidArgumentException("Invalid index {$this->hostIndex} when selecting the host. Must be less than ".sizeof($operationHosts)); + } + $operationHost = $operationHosts[$this->hostIndex]; + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listLogNewrelicotlp + * + * List New Relic OTLP endpoints + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Fastly\Model\LoggingNewrelicotlpResponse[] + */ + public function listLogNewrelicotlp($options) + { + list($response) = $this->listLogNewrelicotlpWithHttpInfo($options); + return $response; + } + + /** + * Operation listLogNewrelicotlpWithHttpInfo + * + * List New Relic OTLP endpoints + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains Fastly API host(s). Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Fastly\Model\LoggingNewrelicotlpResponse[], HTTP status code, HTTP response headers (array of strings) + */ + public function listLogNewrelicotlpWithHttpInfo($options) + { + $request = $this->listLogNewrelicotlpRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('GET' != 'GET' && 'GET' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Fastly\Model\LoggingNewrelicotlpResponse[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\LoggingNewrelicotlpResponse[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\LoggingNewrelicotlpResponse[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Fastly\Model\LoggingNewrelicotlpResponse[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listLogNewrelicotlpAsync + * + * List New Relic OTLP endpoints + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listLogNewrelicotlpAsync($options) + { + return $this->listLogNewrelicotlpAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listLogNewrelicotlpAsyncWithHttpInfo + * + * List New Relic OTLP endpoints + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listLogNewrelicotlpAsyncWithHttpInfo($options) + { + $returnType = '\Fastly\Model\LoggingNewrelicotlpResponse[]'; + $request = $this->listLogNewrelicotlpRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listLogNewrelicotlp' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listLogNewrelicotlpRequest($options) + { + // unbox the parameters from the associative array + $service_id = array_key_exists('service_id', $options) ? $options['service_id'] : null; + $version_id = array_key_exists('version_id', $options) ? $options['version_id'] : null; + + // verify the required parameter 'service_id' is set + if ($service_id === null || (is_array($service_id) && count($service_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $service_id when calling listLogNewrelicotlp' + ); + } + // verify the required parameter 'version_id' is set + if ($version_id === null || (is_array($version_id) && count($version_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $version_id when calling listLogNewrelicotlp' + ); + } + + $resourcePath = '/service/{service_id}/version/{version_id}/logging/newrelicotlp'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($service_id !== null) { + $resourcePath = str_replace( + '{' . 'service_id' . '}', + ObjectSerializer::toPathValue($service_id), + $resourcePath + ); + } + // path params + if ($version_id !== null) { + $resourcePath = str_replace( + '{' . 'version_id' . '}', + ObjectSerializer::toPathValue($version_id), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHosts = ["https://api.fastly.com"]; + if ($this->hostIndex < 0 || $this->hostIndex >= sizeof($operationHosts)) { + throw new \InvalidArgumentException("Invalid index {$this->hostIndex} when selecting the host. Must be less than ".sizeof($operationHosts)); + } + $operationHost = $operationHosts[$this->hostIndex]; + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateLogNewrelicotlp + * + * Update a New Relic log endpoint + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $logging_newrelicotlp_name The name for the real-time logging configuration. (required) + * @param string $name The name for the real-time logging configuration. (optional) + * @param string $placement Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. (optional) + * @param string $response_condition The name of an existing condition in the configured endpoint, or leave blank to always execute. (optional) + * @param string $format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). (optional, default to '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}') + * @param int $format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. (optional, default to self::FORMAT_VERSION_v2) + * @param string $token The Insert API key from the Account page of your New Relic account. Required. (optional) + * @param string $region The region to which to stream logs. (optional, default to 'US') + * @param string $url (Optional) URL of the New Relic Trace Observer, if you are using New Relic Infinite Tracing. (optional, default to 'null') + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Fastly\Model\LoggingNewrelicotlpResponse + */ + public function updateLogNewrelicotlp($options) + { + list($response) = $this->updateLogNewrelicotlpWithHttpInfo($options); + return $response; + } + + /** + * Operation updateLogNewrelicotlpWithHttpInfo + * + * Update a New Relic log endpoint + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains Fastly API host(s). Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $logging_newrelicotlp_name The name for the real-time logging configuration. (required) + * @param string $name The name for the real-time logging configuration. (optional) + * @param string $placement Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. (optional) + * @param string $response_condition The name of an existing condition in the configured endpoint, or leave blank to always execute. (optional) + * @param string $format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). (optional, default to '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}') + * @param int $format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. (optional, default to self::FORMAT_VERSION_v2) + * @param string $token The Insert API key from the Account page of your New Relic account. Required. (optional) + * @param string $region The region to which to stream logs. (optional, default to 'US') + * @param string $url (Optional) URL of the New Relic Trace Observer, if you are using New Relic Infinite Tracing. (optional, default to 'null') + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Fastly\Model\LoggingNewrelicotlpResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function updateLogNewrelicotlpWithHttpInfo($options) + { + $request = $this->updateLogNewrelicotlpRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('PUT' != 'GET' && 'PUT' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Fastly\Model\LoggingNewrelicotlpResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\LoggingNewrelicotlpResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\LoggingNewrelicotlpResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Fastly\Model\LoggingNewrelicotlpResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateLogNewrelicotlpAsync + * + * Update a New Relic log endpoint + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $logging_newrelicotlp_name The name for the real-time logging configuration. (required) + * @param string $name The name for the real-time logging configuration. (optional) + * @param string $placement Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. (optional) + * @param string $response_condition The name of an existing condition in the configured endpoint, or leave blank to always execute. (optional) + * @param string $format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). (optional, default to '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}') + * @param int $format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. (optional, default to self::FORMAT_VERSION_v2) + * @param string $token The Insert API key from the Account page of your New Relic account. Required. (optional) + * @param string $region The region to which to stream logs. (optional, default to 'US') + * @param string $url (Optional) URL of the New Relic Trace Observer, if you are using New Relic Infinite Tracing. (optional, default to 'null') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateLogNewrelicotlpAsync($options) + { + return $this->updateLogNewrelicotlpAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateLogNewrelicotlpAsyncWithHttpInfo + * + * Update a New Relic log endpoint + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $logging_newrelicotlp_name The name for the real-time logging configuration. (required) + * @param string $name The name for the real-time logging configuration. (optional) + * @param string $placement Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. (optional) + * @param string $response_condition The name of an existing condition in the configured endpoint, or leave blank to always execute. (optional) + * @param string $format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). (optional, default to '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}') + * @param int $format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. (optional, default to self::FORMAT_VERSION_v2) + * @param string $token The Insert API key from the Account page of your New Relic account. Required. (optional) + * @param string $region The region to which to stream logs. (optional, default to 'US') + * @param string $url (Optional) URL of the New Relic Trace Observer, if you are using New Relic Infinite Tracing. (optional, default to 'null') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateLogNewrelicotlpAsyncWithHttpInfo($options) + { + $returnType = '\Fastly\Model\LoggingNewrelicotlpResponse'; + $request = $this->updateLogNewrelicotlpRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateLogNewrelicotlp' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * URL: https://api.fastly.com + * + * @param string $service_id Alphanumeric string identifying the service. (required) + * @param int $version_id Integer identifying a service version. (required) + * @param string $logging_newrelicotlp_name The name for the real-time logging configuration. (required) + * @param string $name The name for the real-time logging configuration. (optional) + * @param string $placement Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. (optional) + * @param string $response_condition The name of an existing condition in the configured endpoint, or leave blank to always execute. (optional) + * @param string $format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). (optional, default to '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}') + * @param int $format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. (optional, default to self::FORMAT_VERSION_v2) + * @param string $token The Insert API key from the Account page of your New Relic account. Required. (optional) + * @param string $region The region to which to stream logs. (optional, default to 'US') + * @param string $url (Optional) URL of the New Relic Trace Observer, if you are using New Relic Infinite Tracing. (optional, default to 'null') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateLogNewrelicotlpRequest($options) + { + // unbox the parameters from the associative array + $service_id = array_key_exists('service_id', $options) ? $options['service_id'] : null; + $version_id = array_key_exists('version_id', $options) ? $options['version_id'] : null; + $logging_newrelicotlp_name = array_key_exists('logging_newrelicotlp_name', $options) ? $options['logging_newrelicotlp_name'] : null; + $name = array_key_exists('name', $options) ? $options['name'] : null; + $placement = array_key_exists('placement', $options) ? $options['placement'] : null; + $response_condition = array_key_exists('response_condition', $options) ? $options['response_condition'] : null; + $format = array_key_exists('format', $options) ? $options['format'] : '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}'; + $format_version = array_key_exists('format_version', $options) ? $options['format_version'] : self::FORMAT_VERSION_v2; + $token = array_key_exists('token', $options) ? $options['token'] : null; + $region = array_key_exists('region', $options) ? $options['region'] : 'US'; + $url = array_key_exists('url', $options) ? $options['url'] : 'null'; + + // verify the required parameter 'service_id' is set + if ($service_id === null || (is_array($service_id) && count($service_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $service_id when calling updateLogNewrelicotlp' + ); + } + // verify the required parameter 'version_id' is set + if ($version_id === null || (is_array($version_id) && count($version_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $version_id when calling updateLogNewrelicotlp' + ); + } + // verify the required parameter 'logging_newrelicotlp_name' is set + if ($logging_newrelicotlp_name === null || (is_array($logging_newrelicotlp_name) && count($logging_newrelicotlp_name) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $logging_newrelicotlp_name when calling updateLogNewrelicotlp' + ); + } + + $resourcePath = '/service/{service_id}/version/{version_id}/logging/newrelicotlp/{logging_newrelicotlp_name}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($service_id !== null) { + $resourcePath = str_replace( + '{' . 'service_id' . '}', + ObjectSerializer::toPathValue($service_id), + $resourcePath + ); + } + // path params + if ($version_id !== null) { + $resourcePath = str_replace( + '{' . 'version_id' . '}', + ObjectSerializer::toPathValue($version_id), + $resourcePath + ); + } + // path params + if ($logging_newrelicotlp_name !== null) { + $resourcePath = str_replace( + '{' . 'logging_newrelicotlp_name' . '}', + ObjectSerializer::toPathValue($logging_newrelicotlp_name), + $resourcePath + ); + } + + // form params + if ($name !== null) { + $formParams['name'] = ObjectSerializer::toFormValue($name); + } + // form params + if ($placement !== null) { + $formParams['placement'] = ObjectSerializer::toFormValue($placement); + } + // form params + if ($response_condition !== null) { + $formParams['response_condition'] = ObjectSerializer::toFormValue($response_condition); + } + // form params + if ($format !== null) { + $formParams['format'] = ObjectSerializer::toFormValue($format); + } + // form params + if ($format_version !== null) { + $formParams['format_version'] = ObjectSerializer::toFormValue($format_version); + } + // form params + if ($token !== null) { + $formParams['token'] = ObjectSerializer::toFormValue($token); + } + // form params + if ($region !== null) { + $formParams['region'] = ObjectSerializer::toFormValue($region); + } + // form params + if ($url !== null) { + $formParams['url'] = ObjectSerializer::toFormValue($url); + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/x-www-form-urlencoded'] + ); + } + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHosts = ["https://api.fastly.com"]; + if ($this->hostIndex < 0 || $this->hostIndex >= sizeof($operationHosts)) { + throw new \InvalidArgumentException("Invalid index {$this->hostIndex} when selecting the host. Must be less than ".sizeof($operationHosts)); + } + $operationHost = $operationHosts[$this->hostIndex]; + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/SecretStoreApi.php b/lib/Api/SecretStoreApi.php index 683cdbc3..ded801d4 100644 --- a/lib/Api/SecretStoreApi.php +++ b/lib/Api/SecretStoreApi.php @@ -1005,7 +1005,7 @@ public function deleteSecretStoreRequest($options) /** * Operation getSecretStore * - * Create secret store by ID + * Get secret store by ID * * Note: the input parameter is an associative array with the keys listed as the parameter name below * @@ -1027,7 +1027,7 @@ public function getSecretStore($options) /** * Operation getSecretStoreWithHttpInfo * - * Create secret store by ID + * Get secret store by ID * * Note: the input parameter is an associative array with the keys listed as the parameter name below * @@ -1137,7 +1137,7 @@ public function getSecretStoreWithHttpInfo($options) /** * Operation getSecretStoreAsync * - * Create secret store by ID + * Get secret store by ID * * Note: the input parameter is an associative array with the keys listed as the parameter name below * @@ -1162,7 +1162,7 @@ function ($response) { /** * Operation getSecretStoreAsyncWithHttpInfo * - * Create secret store by ID + * Get secret store by ID * * Note: the input parameter is an associative array with the keys listed as the parameter name below * diff --git a/lib/Api/TlsDomainsApi.php b/lib/Api/TlsDomainsApi.php index 2e05a07e..c4e3f259 100644 --- a/lib/Api/TlsDomainsApi.php +++ b/lib/Api/TlsDomainsApi.php @@ -122,7 +122,7 @@ public function getConfig() * @param string $filter_in_use Optional. Limit the returned domains to those currently using Fastly to terminate TLS with SNI (that is, domains considered \"in use\") Permitted values: true, false. (optional) * @param string $filter_tls_certificates_id Optional. Limit the returned domains to those listed in the given TLS certificate's SAN list. (optional) * @param string $filter_tls_subscriptions_id Optional. Limit the returned domains to those for a given TLS subscription. (optional) - * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_activations`, `tls_certificates`, `tls_subscriptions`, `tls_subscriptions.tls_authorizations`, and `tls_authorizations.globalsign_email_challenge`. (optional) + * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_activations`, `tls_certificates`, `tls_subscriptions`, `tls_subscriptions.tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. (optional) * @param int $page_number Current page. (optional) * @param int $page_size Number of records per page. (optional, default to 20) * @param string $sort The order in which to list the results by creation date. (optional, default to 'created_at') @@ -150,7 +150,7 @@ public function listTlsDomains($options) * @param string $filter_in_use Optional. Limit the returned domains to those currently using Fastly to terminate TLS with SNI (that is, domains considered \"in use\") Permitted values: true, false. (optional) * @param string $filter_tls_certificates_id Optional. Limit the returned domains to those listed in the given TLS certificate's SAN list. (optional) * @param string $filter_tls_subscriptions_id Optional. Limit the returned domains to those for a given TLS subscription. (optional) - * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_activations`, `tls_certificates`, `tls_subscriptions`, `tls_subscriptions.tls_authorizations`, and `tls_authorizations.globalsign_email_challenge`. (optional) + * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_activations`, `tls_certificates`, `tls_subscriptions`, `tls_subscriptions.tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. (optional) * @param int $page_number Current page. (optional) * @param int $page_size Number of records per page. (optional, default to 20) * @param string $sort The order in which to list the results by creation date. (optional, default to 'created_at') @@ -266,7 +266,7 @@ public function listTlsDomainsWithHttpInfo($options) * @param string $filter_in_use Optional. Limit the returned domains to those currently using Fastly to terminate TLS with SNI (that is, domains considered \"in use\") Permitted values: true, false. (optional) * @param string $filter_tls_certificates_id Optional. Limit the returned domains to those listed in the given TLS certificate's SAN list. (optional) * @param string $filter_tls_subscriptions_id Optional. Limit the returned domains to those for a given TLS subscription. (optional) - * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_activations`, `tls_certificates`, `tls_subscriptions`, `tls_subscriptions.tls_authorizations`, and `tls_authorizations.globalsign_email_challenge`. (optional) + * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_activations`, `tls_certificates`, `tls_subscriptions`, `tls_subscriptions.tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. (optional) * @param int $page_number Current page. (optional) * @param int $page_size Number of records per page. (optional, default to 20) * @param string $sort The order in which to list the results by creation date. (optional, default to 'created_at') @@ -297,7 +297,7 @@ function ($response) { * @param string $filter_in_use Optional. Limit the returned domains to those currently using Fastly to terminate TLS with SNI (that is, domains considered \"in use\") Permitted values: true, false. (optional) * @param string $filter_tls_certificates_id Optional. Limit the returned domains to those listed in the given TLS certificate's SAN list. (optional) * @param string $filter_tls_subscriptions_id Optional. Limit the returned domains to those for a given TLS subscription. (optional) - * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_activations`, `tls_certificates`, `tls_subscriptions`, `tls_subscriptions.tls_authorizations`, and `tls_authorizations.globalsign_email_challenge`. (optional) + * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_activations`, `tls_certificates`, `tls_subscriptions`, `tls_subscriptions.tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. (optional) * @param int $page_number Current page. (optional) * @param int $page_size Number of records per page. (optional, default to 20) * @param string $sort The order in which to list the results by creation date. (optional, default to 'created_at') @@ -354,7 +354,7 @@ function ($exception) { * @param string $filter_in_use Optional. Limit the returned domains to those currently using Fastly to terminate TLS with SNI (that is, domains considered \"in use\") Permitted values: true, false. (optional) * @param string $filter_tls_certificates_id Optional. Limit the returned domains to those listed in the given TLS certificate's SAN list. (optional) * @param string $filter_tls_subscriptions_id Optional. Limit the returned domains to those for a given TLS subscription. (optional) - * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_activations`, `tls_certificates`, `tls_subscriptions`, `tls_subscriptions.tls_authorizations`, and `tls_authorizations.globalsign_email_challenge`. (optional) + * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_activations`, `tls_certificates`, `tls_subscriptions`, `tls_subscriptions.tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. (optional) * @param int $page_number Current page. (optional) * @param int $page_size Number of records per page. (optional, default to 20) * @param string $sort The order in which to list the results by creation date. (optional, default to 'created_at') diff --git a/lib/Api/TlsSubscriptionsApi.php b/lib/Api/TlsSubscriptionsApi.php index 4a2efcea..5c2ce3e8 100644 --- a/lib/Api/TlsSubscriptionsApi.php +++ b/lib/Api/TlsSubscriptionsApi.php @@ -1394,7 +1394,7 @@ public function deleteTlsSubRequest($options) * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. * URL: https://api.fastly.com * - * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations` and `tls_authorizations.globalsign_email_challenge`. (optional) + * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. (optional) * @param string $tls_subscription_id Alphanumeric string identifying a TLS subscription. (required) * * @throws \Fastly\ApiException on non-2xx response @@ -1417,7 +1417,7 @@ public function getTlsSub($options) * This operation contains Fastly API host(s). Use 'hostIndex' to select the host. * URL: https://api.fastly.com * - * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations` and `tls_authorizations.globalsign_email_challenge`. (optional) + * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. (optional) * @param string $tls_subscription_id Alphanumeric string identifying a TLS subscription. (required) * * @throws \Fastly\ApiException on non-2xx response @@ -1528,7 +1528,7 @@ public function getTlsSubWithHttpInfo($options) * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. * URL: https://api.fastly.com * - * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations` and `tls_authorizations.globalsign_email_challenge`. (optional) + * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. (optional) * @param string $tls_subscription_id Alphanumeric string identifying a TLS subscription. (required) * * @throws \InvalidArgumentException @@ -1554,7 +1554,7 @@ function ($response) { * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. * URL: https://api.fastly.com * - * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations` and `tls_authorizations.globalsign_email_challenge`. (optional) + * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. (optional) * @param string $tls_subscription_id Alphanumeric string identifying a TLS subscription. (required) * * @throws \InvalidArgumentException @@ -1606,7 +1606,7 @@ function ($exception) { * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. * URL: https://api.fastly.com * - * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations` and `tls_authorizations.globalsign_email_challenge`. (optional) + * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. (optional) * @param string $tls_subscription_id Alphanumeric string identifying a TLS subscription. (required) * * @throws \InvalidArgumentException @@ -1736,7 +1736,7 @@ public function getTlsSubRequest($options) * @param string $filter_state Limit the returned subscriptions by state. Valid values are `pending`, `processing`, `issued`, `renewing`, and `failed`. Accepts parameters: `not` (e.g., `filter[state][not]=renewing`). (optional) * @param string $filter_tls_domains_id Limit the returned subscriptions to those that include the specific domain. (optional) * @param bool $filter_has_active_order Limit the returned subscriptions to those that have currently active orders. Permitted values: `true`. (optional) - * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations` and `tls_authorizations.globalsign_email_challenge`. (optional) + * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. (optional) * @param int $page_number Current page. (optional) * @param int $page_size Number of records per page. (optional, default to 20) * @param string $sort The order in which to list the results by creation date. (optional, default to 'created_at') @@ -1764,7 +1764,7 @@ public function listTlsSubs($options) * @param string $filter_state Limit the returned subscriptions by state. Valid values are `pending`, `processing`, `issued`, `renewing`, and `failed`. Accepts parameters: `not` (e.g., `filter[state][not]=renewing`). (optional) * @param string $filter_tls_domains_id Limit the returned subscriptions to those that include the specific domain. (optional) * @param bool $filter_has_active_order Limit the returned subscriptions to those that have currently active orders. Permitted values: `true`. (optional) - * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations` and `tls_authorizations.globalsign_email_challenge`. (optional) + * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. (optional) * @param int $page_number Current page. (optional) * @param int $page_size Number of records per page. (optional, default to 20) * @param string $sort The order in which to list the results by creation date. (optional, default to 'created_at') @@ -1880,7 +1880,7 @@ public function listTlsSubsWithHttpInfo($options) * @param string $filter_state Limit the returned subscriptions by state. Valid values are `pending`, `processing`, `issued`, `renewing`, and `failed`. Accepts parameters: `not` (e.g., `filter[state][not]=renewing`). (optional) * @param string $filter_tls_domains_id Limit the returned subscriptions to those that include the specific domain. (optional) * @param bool $filter_has_active_order Limit the returned subscriptions to those that have currently active orders. Permitted values: `true`. (optional) - * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations` and `tls_authorizations.globalsign_email_challenge`. (optional) + * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. (optional) * @param int $page_number Current page. (optional) * @param int $page_size Number of records per page. (optional, default to 20) * @param string $sort The order in which to list the results by creation date. (optional, default to 'created_at') @@ -1911,7 +1911,7 @@ function ($response) { * @param string $filter_state Limit the returned subscriptions by state. Valid values are `pending`, `processing`, `issued`, `renewing`, and `failed`. Accepts parameters: `not` (e.g., `filter[state][not]=renewing`). (optional) * @param string $filter_tls_domains_id Limit the returned subscriptions to those that include the specific domain. (optional) * @param bool $filter_has_active_order Limit the returned subscriptions to those that have currently active orders. Permitted values: `true`. (optional) - * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations` and `tls_authorizations.globalsign_email_challenge`. (optional) + * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. (optional) * @param int $page_number Current page. (optional) * @param int $page_size Number of records per page. (optional, default to 20) * @param string $sort The order in which to list the results by creation date. (optional, default to 'created_at') @@ -1968,7 +1968,7 @@ function ($exception) { * @param string $filter_state Limit the returned subscriptions by state. Valid values are `pending`, `processing`, `issued`, `renewing`, and `failed`. Accepts parameters: `not` (e.g., `filter[state][not]=renewing`). (optional) * @param string $filter_tls_domains_id Limit the returned subscriptions to those that include the specific domain. (optional) * @param bool $filter_has_active_order Limit the returned subscriptions to those that have currently active orders. Permitted values: `true`. (optional) - * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations` and `tls_authorizations.globalsign_email_challenge`. (optional) + * @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, and `tls_authorizations.self_managed_http_challenge`. (optional) * @param int $page_number Current page. (optional) * @param int $page_size Number of records per page. (optional, default to 20) * @param string $sort The order in which to list the results by creation date. (optional, default to 'created_at') diff --git a/lib/Configuration.php b/lib/Configuration.php index b7bccdec..3eb1ee64 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -89,7 +89,7 @@ class Configuration * * @var string */ - protected $userAgent = 'fastly-php/4.0.0'; + protected $userAgent = 'fastly-php/4.1.0'; /** * Debug switch (default set to false) @@ -453,7 +453,7 @@ public static function toDebugReport() $report .= ' OS: ' . php_uname() . PHP_EOL; $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; $report .= ' The version of the schema document: 1.0.0' . PHP_EOL; - $report .= ' SDK Package Version: 4.0.0' . PHP_EOL; + $report .= ' SDK Package Version: 4.1.0' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/lib/Model/Backend.php b/lib/Model/Backend.php index 7aa75d6e..caea1eb2 100644 --- a/lib/Model/Backend.php +++ b/lib/Model/Backend.php @@ -72,6 +72,7 @@ class Backend implements ModelInterface, ArrayAccess, \JsonSerializable 'override_host' => 'string', 'port' => 'int', 'request_condition' => 'string', + 'share_key' => 'string', 'shield' => 'string', 'ssl_ca_cert' => 'string', 'ssl_cert_hostname' => 'string', @@ -112,6 +113,7 @@ class Backend implements ModelInterface, ArrayAccess, \JsonSerializable 'override_host' => null, 'port' => null, 'request_condition' => null, + 'share_key' => null, 'shield' => null, 'ssl_ca_cert' => null, 'ssl_cert_hostname' => null, @@ -171,6 +173,7 @@ public static function fastlyFormats() 'override_host' => 'override_host', 'port' => 'port', 'request_condition' => 'request_condition', + 'share_key' => 'share_key', 'shield' => 'shield', 'ssl_ca_cert' => 'ssl_ca_cert', 'ssl_cert_hostname' => 'ssl_cert_hostname', @@ -209,6 +212,7 @@ public static function fastlyFormats() 'override_host' => 'setOverrideHost', 'port' => 'setPort', 'request_condition' => 'setRequestCondition', + 'share_key' => 'setShareKey', 'shield' => 'setShield', 'ssl_ca_cert' => 'setSslCaCert', 'ssl_cert_hostname' => 'setSslCertHostname', @@ -247,6 +251,7 @@ public static function fastlyFormats() 'override_host' => 'getOverrideHost', 'port' => 'getPort', 'request_condition' => 'getRequestCondition', + 'share_key' => 'getShareKey', 'shield' => 'getShield', 'ssl_ca_cert' => 'getSslCaCert', 'ssl_cert_hostname' => 'getSslCertHostname', @@ -336,6 +341,7 @@ public function __construct(array $data = null) $this->container['override_host'] = $data['override_host'] ?? null; $this->container['port'] = $data['port'] ?? null; $this->container['request_condition'] = $data['request_condition'] ?? null; + $this->container['share_key'] = $data['share_key'] ?? null; $this->container['shield'] = $data['shield'] ?? null; $this->container['ssl_ca_cert'] = $data['ssl_ca_cert'] ?? null; $this->container['ssl_cert_hostname'] = $data['ssl_cert_hostname'] ?? null; @@ -358,6 +364,10 @@ public function listInvalidProperties() { $invalidProperties = []; + if (!is_null($this->container['share_key']) && !preg_match("/^[A-Za-z0-9]+$/", $this->container['share_key'])) { + $invalidProperties[] = "invalid value for 'share_key', must be conform to the pattern /^[A-Za-z0-9]+$/."; + } + return $invalidProperties; } @@ -829,6 +839,35 @@ public function setRequestCondition($request_condition) return $this; } + /** + * Gets share_key + * + * @return string|null + */ + public function getShareKey() + { + return $this->container['share_key']; + } + + /** + * Sets share_key + * + * @param string|null $share_key Value that when shared across backends will enable those backends to share the same health check. + * + * @return self + */ + public function setShareKey($share_key) + { + + if (!is_null($share_key) && (!preg_match("/^[A-Za-z0-9]+$/", $share_key))) { + throw new \InvalidArgumentException("invalid value for $share_key when calling Backend., must conform to the pattern /^[A-Za-z0-9]+$/."); + } + + $this->container['share_key'] = $share_key; + + return $this; + } + /** * Gets shield * diff --git a/lib/Model/BackendResponse.php b/lib/Model/BackendResponse.php index 89cce051..dd143975 100644 --- a/lib/Model/BackendResponse.php +++ b/lib/Model/BackendResponse.php @@ -72,6 +72,7 @@ class BackendResponse implements ModelInterface, ArrayAccess, \JsonSerializable 'override_host' => 'string', 'port' => 'int', 'request_condition' => 'string', + 'share_key' => 'string', 'shield' => 'string', 'ssl_ca_cert' => 'string', 'ssl_cert_hostname' => 'string', @@ -118,6 +119,7 @@ class BackendResponse implements ModelInterface, ArrayAccess, \JsonSerializable 'override_host' => null, 'port' => null, 'request_condition' => null, + 'share_key' => null, 'shield' => null, 'ssl_ca_cert' => null, 'ssl_cert_hostname' => null, @@ -183,6 +185,7 @@ public static function fastlyFormats() 'override_host' => 'override_host', 'port' => 'port', 'request_condition' => 'request_condition', + 'share_key' => 'share_key', 'shield' => 'shield', 'ssl_ca_cert' => 'ssl_ca_cert', 'ssl_cert_hostname' => 'ssl_cert_hostname', @@ -227,6 +230,7 @@ public static function fastlyFormats() 'override_host' => 'setOverrideHost', 'port' => 'setPort', 'request_condition' => 'setRequestCondition', + 'share_key' => 'setShareKey', 'shield' => 'setShield', 'ssl_ca_cert' => 'setSslCaCert', 'ssl_cert_hostname' => 'setSslCertHostname', @@ -271,6 +275,7 @@ public static function fastlyFormats() 'override_host' => 'getOverrideHost', 'port' => 'getPort', 'request_condition' => 'getRequestCondition', + 'share_key' => 'getShareKey', 'shield' => 'getShield', 'ssl_ca_cert' => 'getSslCaCert', 'ssl_cert_hostname' => 'getSslCertHostname', @@ -366,6 +371,7 @@ public function __construct(array $data = null) $this->container['override_host'] = $data['override_host'] ?? null; $this->container['port'] = $data['port'] ?? null; $this->container['request_condition'] = $data['request_condition'] ?? null; + $this->container['share_key'] = $data['share_key'] ?? null; $this->container['shield'] = $data['shield'] ?? null; $this->container['ssl_ca_cert'] = $data['ssl_ca_cert'] ?? null; $this->container['ssl_cert_hostname'] = $data['ssl_cert_hostname'] ?? null; @@ -394,6 +400,10 @@ public function listInvalidProperties() { $invalidProperties = []; + if (!is_null($this->container['share_key']) && !preg_match("/^[A-Za-z0-9]+$/", $this->container['share_key'])) { + $invalidProperties[] = "invalid value for 'share_key', must be conform to the pattern /^[A-Za-z0-9]+$/."; + } + return $invalidProperties; } @@ -865,6 +875,35 @@ public function setRequestCondition($request_condition) return $this; } + /** + * Gets share_key + * + * @return string|null + */ + public function getShareKey() + { + return $this->container['share_key']; + } + + /** + * Sets share_key + * + * @param string|null $share_key Value that when shared across backends will enable those backends to share the same health check. + * + * @return self + */ + public function setShareKey($share_key) + { + + if (!is_null($share_key) && (!preg_match("/^[A-Za-z0-9]+$/", $share_key))) { + throw new \InvalidArgumentException("invalid value for $share_key when calling BackendResponse., must conform to the pattern /^[A-Za-z0-9]+$/."); + } + + $this->container['share_key'] = $share_key; + + return $this; + } + /** * Gets shield * diff --git a/lib/Model/LoggingNewrelicotlpAdditional.php b/lib/Model/LoggingNewrelicotlpAdditional.php new file mode 100644 index 00000000..87379259 --- /dev/null +++ b/lib/Model/LoggingNewrelicotlpAdditional.php @@ -0,0 +1,438 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class LoggingNewrelicotlpAdditional implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $fastlyModelName = 'logging_newrelicotlp_additional'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $fastlyTypes = [ + 'format' => 'string', + 'token' => 'string', + 'region' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $fastlyFormats = [ + 'format' => null, + 'token' => null, + 'region' => null, + 'url' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function fastlyTypes() + { + return self::$fastlyTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function fastlyFormats() + { + return self::$fastlyFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'format' => 'format', + 'token' => 'token', + 'region' => 'region', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'format' => 'setFormat', + 'token' => 'setToken', + 'region' => 'setRegion', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'format' => 'getFormat', + 'token' => 'getToken', + 'region' => 'getRegion', + 'url' => 'getUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$fastlyModelName; + } + + const REGION_US = 'US'; + const REGION_EU = 'EU'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRegionAllowableValues() + { + return [ + self::REGION_US, + self::REGION_EU, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['format'] = $data['format'] ?? '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}'; + $this->container['token'] = $data['token'] ?? null; + $this->container['region'] = $data['region'] ?? 'US'; + $this->container['url'] = $data['url'] ?? 'null'; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getRegionAllowableValues(); + if (!is_null($this->container['region']) && !in_array($this->container['region'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'region', must be one of '%s'", + $this->container['region'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets format + * + * @return string|null + */ + public function getFormat() + { + return $this->container['format']; + } + + /** + * Sets format + * + * @param string|null $format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). + * + * @return self + */ + public function setFormat($format) + { + $this->container['format'] = $format; + + return $this; + } + + /** + * Gets token + * + * @return string|null + */ + public function getToken() + { + return $this->container['token']; + } + + /** + * Sets token + * + * @param string|null $token The Insert API key from the Account page of your New Relic account. Required. + * + * @return self + */ + public function setToken($token) + { + $this->container['token'] = $token; + + return $this; + } + + /** + * Gets region + * + * @return string|null + */ + public function getRegion() + { + return $this->container['region']; + } + + /** + * Sets region + * + * @param string|null $region The region to which to stream logs. + * + * @return self + */ + public function setRegion($region) + { + $allowedValues = $this->getRegionAllowableValues(); + if (!is_null($region) && !in_array($region, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'region', must be one of '%s'", + $region, + implode("', '", $allowedValues) + ) + ); + } + $this->container['region'] = $region; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url (Optional) URL of the New Relic Trace Observer, if you are using New Relic Infinite Tracing. + * + * @return self + */ + public function setUrl($url) + { + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/LoggingNewrelicotlpResponse.php b/lib/Model/LoggingNewrelicotlpResponse.php new file mode 100644 index 00000000..41c53826 --- /dev/null +++ b/lib/Model/LoggingNewrelicotlpResponse.php @@ -0,0 +1,778 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class LoggingNewrelicotlpResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $fastlyModelName = 'logging_newrelicotlp_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $fastlyTypes = [ + 'name' => 'string', + 'placement' => 'string', + 'response_condition' => 'string', + 'format' => 'string', + 'format_version' => 'string', + 'token' => 'string', + 'region' => 'string', + 'url' => 'string', + 'created_at' => '\DateTime', + 'deleted_at' => '\DateTime', + 'updated_at' => '\DateTime', + 'service_id' => 'string', + 'version' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $fastlyFormats = [ + 'name' => null, + 'placement' => null, + 'response_condition' => null, + 'format' => null, + 'format_version' => null, + 'token' => null, + 'region' => null, + 'url' => null, + 'created_at' => 'date-time', + 'deleted_at' => 'date-time', + 'updated_at' => 'date-time', + 'service_id' => null, + 'version' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function fastlyTypes() + { + return self::$fastlyTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function fastlyFormats() + { + return self::$fastlyFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'placement' => 'placement', + 'response_condition' => 'response_condition', + 'format' => 'format', + 'format_version' => 'format_version', + 'token' => 'token', + 'region' => 'region', + 'url' => 'url', + 'created_at' => 'created_at', + 'deleted_at' => 'deleted_at', + 'updated_at' => 'updated_at', + 'service_id' => 'service_id', + 'version' => 'version' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'placement' => 'setPlacement', + 'response_condition' => 'setResponseCondition', + 'format' => 'setFormat', + 'format_version' => 'setFormatVersion', + 'token' => 'setToken', + 'region' => 'setRegion', + 'url' => 'setUrl', + 'created_at' => 'setCreatedAt', + 'deleted_at' => 'setDeletedAt', + 'updated_at' => 'setUpdatedAt', + 'service_id' => 'setServiceId', + 'version' => 'setVersion' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'placement' => 'getPlacement', + 'response_condition' => 'getResponseCondition', + 'format' => 'getFormat', + 'format_version' => 'getFormatVersion', + 'token' => 'getToken', + 'region' => 'getRegion', + 'url' => 'getUrl', + 'created_at' => 'getCreatedAt', + 'deleted_at' => 'getDeletedAt', + 'updated_at' => 'getUpdatedAt', + 'service_id' => 'getServiceId', + 'version' => 'getVersion' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$fastlyModelName; + } + + const PLACEMENT_NONE = 'none'; + const PLACEMENT_WAF_DEBUG = 'waf_debug'; + const PLACEMENT_NULL = 'null'; + const FORMAT_VERSION_v1 = '1'; + const FORMAT_VERSION_v2 = '2'; + const REGION_US = 'US'; + const REGION_EU = 'EU'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getPlacementAllowableValues() + { + return [ + self::PLACEMENT_NONE, + self::PLACEMENT_WAF_DEBUG, + self::PLACEMENT_NULL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFormatVersionAllowableValues() + { + return [ + self::FORMAT_VERSION_v1, + self::FORMAT_VERSION_v2, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRegionAllowableValues() + { + return [ + self::REGION_US, + self::REGION_EU, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['name'] = $data['name'] ?? null; + $this->container['placement'] = $data['placement'] ?? null; + $this->container['response_condition'] = $data['response_condition'] ?? null; + $this->container['format'] = $data['format'] ?? '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}'; + $this->container['format_version'] = $data['format_version'] ?? '2'; + $this->container['token'] = $data['token'] ?? null; + $this->container['region'] = $data['region'] ?? 'US'; + $this->container['url'] = $data['url'] ?? 'null'; + $this->container['created_at'] = $data['created_at'] ?? null; + $this->container['deleted_at'] = $data['deleted_at'] ?? null; + $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->container['service_id'] = $data['service_id'] ?? null; + $this->container['version'] = $data['version'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getPlacementAllowableValues(); + if (!is_null($this->container['placement']) && !in_array($this->container['placement'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'placement', must be one of '%s'", + $this->container['placement'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getFormatVersionAllowableValues(); + if (!is_null($this->container['format_version']) && !in_array($this->container['format_version'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'format_version', must be one of '%s'", + $this->container['format_version'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRegionAllowableValues(); + if (!is_null($this->container['region']) && !in_array($this->container['region'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'region', must be one of '%s'", + $this->container['region'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name for the real-time logging configuration. + * + * @return self + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets placement + * + * @return string|null + */ + public function getPlacement() + { + return $this->container['placement']; + } + + /** + * Sets placement + * + * @param string|null $placement Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. + * + * @return self + */ + public function setPlacement($placement) + { + $allowedValues = $this->getPlacementAllowableValues(); + if (!is_null($placement) && !in_array($placement, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'placement', must be one of '%s'", + $placement, + implode("', '", $allowedValues) + ) + ); + } + $this->container['placement'] = $placement; + + return $this; + } + + /** + * Gets response_condition + * + * @return string|null + */ + public function getResponseCondition() + { + return $this->container['response_condition']; + } + + /** + * Sets response_condition + * + * @param string|null $response_condition The name of an existing condition in the configured endpoint, or leave blank to always execute. + * + * @return self + */ + public function setResponseCondition($response_condition) + { + $this->container['response_condition'] = $response_condition; + + return $this; + } + + /** + * Gets format + * + * @return string|null + */ + public function getFormat() + { + return $this->container['format']; + } + + /** + * Sets format + * + * @param string|null $format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). + * + * @return self + */ + public function setFormat($format) + { + $this->container['format'] = $format; + + return $this; + } + + /** + * Gets format_version + * + * @return string|null + */ + public function getFormatVersion() + { + return $this->container['format_version']; + } + + /** + * Sets format_version + * + * @param string|null $format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. + * + * @return self + */ + public function setFormatVersion($format_version) + { + $allowedValues = $this->getFormatVersionAllowableValues(); + if (!is_null($format_version) && !in_array($format_version, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'format_version', must be one of '%s'", + $format_version, + implode("', '", $allowedValues) + ) + ); + } + $this->container['format_version'] = $format_version; + + return $this; + } + + /** + * Gets token + * + * @return string|null + */ + public function getToken() + { + return $this->container['token']; + } + + /** + * Sets token + * + * @param string|null $token The Insert API key from the Account page of your New Relic account. Required. + * + * @return self + */ + public function setToken($token) + { + $this->container['token'] = $token; + + return $this; + } + + /** + * Gets region + * + * @return string|null + */ + public function getRegion() + { + return $this->container['region']; + } + + /** + * Sets region + * + * @param string|null $region The region to which to stream logs. + * + * @return self + */ + public function setRegion($region) + { + $allowedValues = $this->getRegionAllowableValues(); + if (!is_null($region) && !in_array($region, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'region', must be one of '%s'", + $region, + implode("', '", $allowedValues) + ) + ); + } + $this->container['region'] = $region; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url (Optional) URL of the New Relic Trace Observer, if you are using New Relic Infinite Tracing. + * + * @return self + */ + public function setUrl($url) + { + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime|null $created_at Date and time in ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($created_at) + { + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets deleted_at + * + * @return \DateTime|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param \DateTime|null $deleted_at Date and time in ISO 8601 format. + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime|null $updated_at Date and time in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets service_id + * + * @return string|null + */ + public function getServiceId() + { + return $this->container['service_id']; + } + + /** + * Sets service_id + * + * @param string|null $service_id service_id + * + * @return self + */ + public function setServiceId($service_id) + { + $this->container['service_id'] = $service_id; + + return $this; + } + + /** + * Gets version + * + * @return string|null + */ + public function getVersion() + { + return $this->container['version']; + } + + /** + * Sets version + * + * @param string|null $version version + * + * @return self + */ + public function setVersion($version) + { + $this->container['version'] = $version; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/RateLimiter.php b/lib/Model/RateLimiter.php index bbb234b2..bab6a7ec 100644 --- a/lib/Model/RateLimiter.php +++ b/lib/Model/RateLimiter.php @@ -244,6 +244,7 @@ public function getModelName() const LOGGER_TYPE_LOGGLY = 'loggly'; const LOGGER_TYPE_LOGSHUTTLE = 'logshuttle'; const LOGGER_TYPE_NEWRELIC = 'newrelic'; + const LOGGER_TYPE_NEWRELICOTLP = 'newrelicotlp'; const LOGGER_TYPE_OPENSTACK = 'openstack'; const LOGGER_TYPE_PAPERTRAIL = 'papertrail'; const LOGGER_TYPE_PUBSUB = 'pubsub'; @@ -329,6 +330,7 @@ public function getLoggerTypeAllowableValues() self::LOGGER_TYPE_LOGGLY, self::LOGGER_TYPE_LOGSHUTTLE, self::LOGGER_TYPE_NEWRELIC, + self::LOGGER_TYPE_NEWRELICOTLP, self::LOGGER_TYPE_OPENSTACK, self::LOGGER_TYPE_PAPERTRAIL, self::LOGGER_TYPE_PUBSUB, diff --git a/lib/Model/RateLimiterResponse.php b/lib/Model/RateLimiterResponse.php index 889d71f3..cd2e8880 100644 --- a/lib/Model/RateLimiterResponse.php +++ b/lib/Model/RateLimiterResponse.php @@ -274,6 +274,7 @@ public function getModelName() const LOGGER_TYPE_LOGGLY = 'loggly'; const LOGGER_TYPE_LOGSHUTTLE = 'logshuttle'; const LOGGER_TYPE_NEWRELIC = 'newrelic'; + const LOGGER_TYPE_NEWRELICOTLP = 'newrelicotlp'; const LOGGER_TYPE_OPENSTACK = 'openstack'; const LOGGER_TYPE_PAPERTRAIL = 'papertrail'; const LOGGER_TYPE_PUBSUB = 'pubsub'; @@ -359,6 +360,7 @@ public function getLoggerTypeAllowableValues() self::LOGGER_TYPE_LOGGLY, self::LOGGER_TYPE_LOGSHUTTLE, self::LOGGER_TYPE_NEWRELIC, + self::LOGGER_TYPE_NEWRELICOTLP, self::LOGGER_TYPE_OPENSTACK, self::LOGGER_TYPE_PAPERTRAIL, self::LOGGER_TYPE_PUBSUB, diff --git a/sig.json b/sig.json index 65857946..af51c000 100644 --- a/sig.json +++ b/sig.json @@ -1 +1 @@ -{"G": "2914592f", "D": "7e4f4edd"} +{"G": "a5d4c17e", "D": "6ddfaf95"}