openapi

package
v4.0.0-rc.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 6 Imported by: 0

README

Go API client for

IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API.

There is no limit to the number of IP addresses that you can allow.

It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses.

See IP Access Management for more information.

Overview

This API client was generated by the OpenAPI Generator project from the OpenAPI specs located at twilio/sendgrid-oai. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.0.0
  • Package version:
  • Build date: 2024-10-24T13:26:01.909244Z[Etc/UTC]
  • Build package: com.sendgrid.oai.go.SendgridGoGenerator For more information, please visit https://support.sendgrid.com/hc/en-us

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import "./"

Documentation for API Endpoints

All URIs are relative to https://api.sendgrid.com

Class Method HTTP request Description
AddIpToAllowList AddIpToAllowList Post /v3/access_settings/whitelist Add one or more IPs to the allow list
DeleteAllowedIp DeleteAllowedIp Delete /v3/access_settings/whitelist/{RuleId} Remove a specific IP from the allowed list
DeleteAllowedIps DeleteAllowedIps Delete /v3/access_settings/whitelist Remove one or more IPs from the allow list
GetAllowedIp GetAllowedIp Get /v3/access_settings/whitelist/{RuleId} Retrieve a specific allowed IP
ListAccessActivity ListAccessActivity Get /v3/access_settings/activity Retrieve all recent access attempts
ListAllowedIp ListAllowedIp Get /v3/access_settings/whitelist Retrieve a list of currently allowed IPs

Documentation For Models

Documentation For Authorization

BearerAuth

  • Type: HTTP basic authentication

Example

auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
    UserName: "username",
    Password: "password",
})
r, err := client.Service.Operation(auth, args)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddIpToAllowListParam

type AddIpToAllowListParam struct {
	// The `on-behalf-of` header allows you to make API calls from a parent account on behalf of the parent's Subusers or customer accounts. You will use the parent account's API key when using this header. When making a call on behalf of a customer account, the property value should be \"account-id\" followed by the customer account's ID (e.g., `on-behalf-of: account-id <account-id>`). When making a call on behalf of a Subuser, the property value should be the Subuser's username (e.g., `on-behalf-of: <subuser-username>`). See [**On Behalf Of**](https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/on-behalf-of) for more information.
	Onbehalfof *string `json:"on-behalf-of,omitempty"`
	//
	AddIpToAllowListRequest *AddIpToAllowListRequest `json:"AddIpToAllowListRequest,omitempty"`
}

func (*AddIpToAllowListParam) SetAddIpToAllowListRequest

func (params *AddIpToAllowListParam) SetAddIpToAllowListRequest(AddIpToAllowListRequest AddIpToAllowListRequest) *AddIpToAllowListParam

func (*AddIpToAllowListParam) SetOnbehalfof

func (params *AddIpToAllowListParam) SetOnbehalfof(Onbehalfof string) *AddIpToAllowListParam

type AddIpToAllowListRequest

type AddIpToAllowListRequest struct {
	// An array containing the IP(s) you want to allow.
	Ips []AddIpToAllowListRequestIpsInner `json:"ips"`
}

AddIpToAllowListRequest struct for AddIpToAllowListRequest

type AddIpToAllowListRequestIpsInner

type AddIpToAllowListRequestIpsInner struct {
	// An IP address that you want to allow.
	Ip string `json:"ip"`
}

AddIpToAllowListRequestIpsInner struct for AddIpToAllowListRequestIpsInner

type ApiService

type ApiService struct {
	// contains filtered or unexported fields
}

func NewApiService

func NewApiService(requestHandler *sendgrid.RequestHandler) *ApiService

func NewApiServiceWithClient

func NewApiServiceWithClient(client sendgrid.BaseClient) *ApiService

func (*ApiService) AddIpToAllowList

func (c *ApiService) AddIpToAllowList(params *AddIpToAllowListParam) (interface{}, error)

**This endpoint allows you to add one or more allowed IP addresses.** To allow one or more IP addresses, pass them to this endpoint in an array. Once an IP address is added to your allow list, it will be assigned an `id` that can be used to remove the address. You can retrieve the ID associated with an IP using the \"Retrieve a list of currently allowed IPs\" endpoint.

func (*ApiService) DeleteAllowedIp

func (c *ApiService) DeleteAllowedIp(params *DeleteAllowedIpParam) (interface{}, error)

**This endpoint allows you to remove a specific IP address from your list of allowed addresses.** When removing a specific IP address from your list, you must include the ID in your call. You can retrieve the IDs associated with your allowed IP addresses using the \"Retrieve a list of currently allowed IPs\" endpoint.

func (*ApiService) DeleteAllowedIps

func (c *ApiService) DeleteAllowedIps(params *DeleteAllowedIpsParam) (interface{}, error)

**This endpoint allows you to remove one or more IP addresses from your list of allowed addresses.** To remove one or more IP addresses, pass this endpoint an array containing the ID(s) associated with the IP(s) you intend to remove. You can retrieve the IDs associated with your allowed IP addresses using the \"Retrieve a list of currently allowed IPs\" endpoint. It is possible to remove your own IP address, which will block access to your account. You will need to submit a [support ticket](https://sendgrid.com/docs/ui/account-and-settings/support/) if this happens. For this reason, it is important to double check that you are removing only the IPs you intend to remove when using this endpoint.

func (*ApiService) GetAllowedIp

func (c *ApiService) GetAllowedIp(params *GetAllowedIpParam) (interface{}, error)

**This endpoint allows you to retreive a specific IP address that has been allowed to access your account.** You must include the ID for the specific IP address you want to retrieve in your call. You can retrieve the IDs associated with your allowed IP addresses using the \"Retrieve a list of currently allowed IPs\" endpoint.

func (*ApiService) ListAccessActivity

func (c *ApiService) ListAccessActivity(params *ListAccessActivityParam) (interface{}, error)

**This endpoint allows you to retrieve a list of all of the IP addresses that recently attempted to access your account either through the User Interface or the API.**

func (*ApiService) ListAllowedIp

func (c *ApiService) ListAllowedIp(params *ListAllowedIpParam) (interface{}, error)

**This endpoint allows you to retrieve a list of IP addresses that are currently allowed to access your account.** Each IP address returned to you will have `created_at` and `updated_at` dates. Each IP will also be associated with an `id` that can be used to remove the address from your allow list.

type DeleteAllowedIpParam

type DeleteAllowedIpParam struct {
	// The ID of the allowed IP address that you want to retrieve.
	RuleId *string `json:"rule_id"`
	// The `on-behalf-of` header allows you to make API calls from a parent account on behalf of the parent's Subusers or customer accounts. You will use the parent account's API key when using this header. When making a call on behalf of a customer account, the property value should be \"account-id\" followed by the customer account's ID (e.g., `on-behalf-of: account-id <account-id>`). When making a call on behalf of a Subuser, the property value should be the Subuser's username (e.g., `on-behalf-of: <subuser-username>`). See [**On Behalf Of**](https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/on-behalf-of) for more information.
	Onbehalfof *string `json:"on-behalf-of,omitempty"`
}

func (*DeleteAllowedIpParam) SetOnbehalfof

func (params *DeleteAllowedIpParam) SetOnbehalfof(Onbehalfof string) *DeleteAllowedIpParam

func (*DeleteAllowedIpParam) SetRuleId

func (params *DeleteAllowedIpParam) SetRuleId(RuleId string) *DeleteAllowedIpParam

type DeleteAllowedIpsParam

type DeleteAllowedIpsParam struct {
	// The `on-behalf-of` header allows you to make API calls from a parent account on behalf of the parent's Subusers or customer accounts. You will use the parent account's API key when using this header. When making a call on behalf of a customer account, the property value should be \"account-id\" followed by the customer account's ID (e.g., `on-behalf-of: account-id <account-id>`). When making a call on behalf of a Subuser, the property value should be the Subuser's username (e.g., `on-behalf-of: <subuser-username>`). See [**On Behalf Of**](https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/on-behalf-of) for more information.
	Onbehalfof *string `json:"on-behalf-of,omitempty"`
	//
	DeleteAllowedIpsRequest *DeleteAllowedIpsRequest `json:"DeleteAllowedIpsRequest,omitempty"`
}

func (*DeleteAllowedIpsParam) SetDeleteAllowedIpsRequest

func (params *DeleteAllowedIpsParam) SetDeleteAllowedIpsRequest(DeleteAllowedIpsRequest DeleteAllowedIpsRequest) *DeleteAllowedIpsParam

func (*DeleteAllowedIpsParam) SetOnbehalfof

func (params *DeleteAllowedIpsParam) SetOnbehalfof(Onbehalfof string) *DeleteAllowedIpsParam

type DeleteAllowedIpsRequest

type DeleteAllowedIpsRequest struct {
	// An array of the IDs of the IP address that you want to remove from your allow list.
	Ids *[]int32 `json:"ids,omitempty"`
}

DeleteAllowedIpsRequest struct for DeleteAllowedIpsRequest

type ErrorResponse

type ErrorResponse struct {
	Errors *[]ErrorResponseErrorsInner `json:"errors,omitempty"`
	// When applicable, this property value will be an error ID.
	Id *string `json:"id,omitempty"`
}

ErrorResponse struct for ErrorResponse

type ErrorResponseErrorsInner

type ErrorResponseErrorsInner struct {
	// An error message.
	Message *string `json:"message,omitempty"`
	// When applicable, this property value will be the field that generated the error.
	Field *string `json:"field,omitempty"`
	// When applicable, this property value will be helper text or a link to documentation to help you troubleshoot the error.
	Help *map[string]interface{} `json:"help,omitempty"`
}

ErrorResponseErrorsInner struct for ErrorResponseErrorsInner

type GetAllowedIpParam

type GetAllowedIpParam struct {
	// The ID of the allowed IP address that you want to retrieve.
	RuleId *string `json:"rule_id"`
	// The `on-behalf-of` header allows you to make API calls from a parent account on behalf of the parent's Subusers or customer accounts. You will use the parent account's API key when using this header. When making a call on behalf of a customer account, the property value should be \"account-id\" followed by the customer account's ID (e.g., `on-behalf-of: account-id <account-id>`). When making a call on behalf of a Subuser, the property value should be the Subuser's username (e.g., `on-behalf-of: <subuser-username>`). See [**On Behalf Of**](https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/on-behalf-of) for more information.
	Onbehalfof *string `json:"on-behalf-of,omitempty"`
}

func (*GetAllowedIpParam) SetOnbehalfof

func (params *GetAllowedIpParam) SetOnbehalfof(Onbehalfof string) *GetAllowedIpParam

func (*GetAllowedIpParam) SetRuleId

func (params *GetAllowedIpParam) SetRuleId(RuleId string) *GetAllowedIpParam

type IpAccessManagement2xx

type IpAccessManagement2xx struct {
	// An array listing one or more of your allowed IPs.
	Result *[]IpAccessManagement2xxResultInner `json:"result,omitempty"`
}

IpAccessManagement2xx struct for IpAccessManagement2xx

type IpAccessManagement2xxResultInner

type IpAccessManagement2xxResultInner struct {
	// The ID of the allowed IP.
	Id *int32 `json:"id,omitempty"`
	// The allowed IP.
	Ip *string `json:"ip,omitempty"`
	// A Unix timestamp indicating when the IP was added to the allow list.
	CreatedAt *int32 `json:"created_at,omitempty"`
	// A Unix timestamp indicating when the IPs allow status was most recently updated.
	UpdatedAt *int32 `json:"updated_at,omitempty"`
}

IpAccessManagement2xxResultInner struct for IpAccessManagement2xxResultInner

type ListAccessActivity200Response

type ListAccessActivity200Response struct {
	// An array containing the IPs that recently attempted to access your account.
	Result []ListAccessActivity200ResponseResultInner `json:"result"`
}

ListAccessActivity200Response struct for ListAccessActivity200Response

type ListAccessActivity200ResponseResultInner

type ListAccessActivity200ResponseResultInner struct {
	// Indicates if the IP address was granted access to the account.
	Allowed bool `json:"allowed"`
	// The authentication method used when attempting access.
	AuthMethod string `json:"auth_method"`
	// A Unix timestamp indicating when the first access attempt was made.
	FirstAt int32 `json:"first_at"`
	// The IP addressed used during the access attempt.
	Ip string `json:"ip"`
	// A Unix timestamp indicating when the most recent access attempt was made
	LastAt int32 `json:"last_at"`
	// The geographic location from which the access attempt originated.
	Location string `json:"location"`
}

ListAccessActivity200ResponseResultInner struct for ListAccessActivity200ResponseResultInner

type ListAccessActivityParam

type ListAccessActivityParam struct {
	// Limits the number of IPs to return.
	Limit *int32 `json:"limit,omitempty"`
	// The `on-behalf-of` header allows you to make API calls from a parent account on behalf of the parent's Subusers or customer accounts. You will use the parent account's API key when using this header. When making a call on behalf of a customer account, the property value should be \"account-id\" followed by the customer account's ID (e.g., `on-behalf-of: account-id <account-id>`). When making a call on behalf of a Subuser, the property value should be the Subuser's username (e.g., `on-behalf-of: <subuser-username>`). See [**On Behalf Of**](https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/on-behalf-of) for more information.
	Onbehalfof *string `json:"on-behalf-of,omitempty"`
}

func (*ListAccessActivityParam) SetLimit

func (params *ListAccessActivityParam) SetLimit(Limit int32) *ListAccessActivityParam

func (*ListAccessActivityParam) SetOnbehalfof

func (params *ListAccessActivityParam) SetOnbehalfof(Onbehalfof string) *ListAccessActivityParam

type ListAllowedIpParam

type ListAllowedIpParam struct {
	// The `on-behalf-of` header allows you to make API calls from a parent account on behalf of the parent's Subusers or customer accounts. You will use the parent account's API key when using this header. When making a call on behalf of a customer account, the property value should be \"account-id\" followed by the customer account's ID (e.g., `on-behalf-of: account-id <account-id>`). When making a call on behalf of a Subuser, the property value should be the Subuser's username (e.g., `on-behalf-of: <subuser-username>`). See [**On Behalf Of**](https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/on-behalf-of) for more information.
	Onbehalfof *string `json:"on-behalf-of,omitempty"`
}

func (*ListAllowedIpParam) SetOnbehalfof

func (params *ListAllowedIpParam) SetOnbehalfof(Onbehalfof string) *ListAllowedIpParam

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL