-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
INTMDB-364: [Terraform] Add support for serverless private endpoints #314
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! 🎉 Just one small comment
mongodbatlas/private_endpoints.go
Outdated
|
||
// List retrieve details for all private Serverless endpoint services in one Atlas project. | ||
// | ||
// See more: https://www.mongodb.com/docs/atlas/reference/api/serverless-private-endpoints-get-all/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[q] Could we stop using this doc page that will be deprecated soon and start using https://www.mongodb.com/docs/atlas/reference/api-resources-spec/#tag/Serverless-Private-Endpoints (autogenerated with open API annotations)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please refer to the up to date docs https://www.mongodb.com/docs/atlas/reference/api-resources-spec/#tag/Serverless-Private-Endpoints, please notice the correct term is serverless private endpoint and not private serverless endpoint which seems used all over the place also this seems to only cover the AWS private endpoint and not the azure one
// PrivateEndpointsService is an interface for interfacing with the Private Endpoints | ||
// of the MongoDB Atlas API. | ||
// | ||
// See more: https://docs.atlas.mongodb.com/reference/api/private-endpoints/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// See more: https://docs.atlas.mongodb.com/reference/api/private-endpoints/ | |
// See more: https://www.mongodb.com/docs/atlas/reference/api-resources-spec/#tag/Serverless-Private-Endpoints |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gssbzn Was using docs at the time that stated ... Creates one private endpoint for one Atlas serverless instance. Serverless instances support private endpoints on AWS only. Will have to add support for Azure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@martinstibbe Azure support is ok to do as a follow up
// of the MongoDB Atlas API. | ||
// | ||
// See more: https://docs.atlas.mongodb.com/reference/api/private-endpoints/ | ||
type PrivateServerlessEndpointsService interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type PrivateServerlessEndpointsService interface { | |
type ServerlessPrivateEndpointsService interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored
serverlessPrivateEndpointsPath = "api/atlas/v1.0/groups/%s/privateEndpoint/serverless/instance/%s/endpoint" | ||
) | ||
|
||
// PrivateEndpointsService is an interface for interfacing with the Private Endpoints |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// PrivateEndpointsService is an interface for interfacing with the Private Endpoints | |
// ServerlessPrivateEndpointsService is an interface for interfacing with the Private Endpoints |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored
// List retrieve details for all private Serverless endpoint services in one Atlas project. | ||
// | ||
// See more: https://www.mongodb.com/docs/atlas/reference/api-resources-spec/#operation/returnAllPrivateEndpointsForOneServerlessInstance | ||
func (s *PrivateServerlessEndpointsServiceOp) ListPrivateServerlessEndpoint(ctx context.Context, groupID, instanceID string, listOptions *ListOptions) ([]PrivateServerlessEndpointConnection, *Response, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// List retrieve details for all private Serverless endpoint services in one Atlas project. | |
// | |
// See more: https://www.mongodb.com/docs/atlas/reference/api-resources-spec/#operation/returnAllPrivateEndpointsForOneServerlessInstance | |
func (s *PrivateServerlessEndpointsServiceOp) ListPrivateServerlessEndpoint(ctx context.Context, groupID, instanceID string, listOptions *ListOptions) ([]PrivateServerlessEndpointConnection, *Response, error) { | |
// List retrieve details for all private Serverless endpoint services in one Atlas project. | |
// | |
// See more: https://www.mongodb.com/docs/atlas/reference/api-resources-spec/#operation/returnAllPrivateEndpointsForOneServerlessInstance | |
func (s *PrivateServerlessEndpointsServiceOp) List(ctx context.Context, groupID, instanceName string, listOptions *ListOptions) ([]PrivateServerlessEndpointConnection, *Response, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored
var _ PrivateServerlessEndpointsService = &PrivateServerlessEndpointsServiceOp{} | ||
|
||
// PrivateEndpointServerlessConnection represents MongoDB Private Endpoint Connection. | ||
type PrivateServerlessEndpointConnection struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type PrivateServerlessEndpointConnection struct { | |
type ServerlessPrivateEndpointConnection struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored
ListPrivateServerlessEndpoint(context.Context, string, string, *ListOptions) ([]PrivateServerlessEndpointConnection, *Response, error) | ||
AddOnePrivateServerlessEndpoint(context.Context, string, string, *PrivateServerlessEndpointConnection) (*PrivateServerlessEndpointConnection, *Response, error) | ||
GetOnePrivateServerlessEndpoint(context.Context, string, string, string) (*PrivateServerlessEndpointConnection, *Response, error) | ||
DeleteOnePrivateServerlessEndpoint(context.Context, string, string, string) (*Response, error) | ||
UpdateOnePrivateServerlessEndpoint(context.Context, string, string, string, *PrivateServerlessEndpointConnection) (*PrivateServerlessEndpointConnection, *Response, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ListPrivateServerlessEndpoint(context.Context, string, string, *ListOptions) ([]PrivateServerlessEndpointConnection, *Response, error) | |
AddOnePrivateServerlessEndpoint(context.Context, string, string, *PrivateServerlessEndpointConnection) (*PrivateServerlessEndpointConnection, *Response, error) | |
GetOnePrivateServerlessEndpoint(context.Context, string, string, string) (*PrivateServerlessEndpointConnection, *Response, error) | |
DeleteOnePrivateServerlessEndpoint(context.Context, string, string, string) (*Response, error) | |
UpdateOnePrivateServerlessEndpoint(context.Context, string, string, string, *PrivateServerlessEndpointConnection) (*PrivateServerlessEndpointConnection, *Response, error) | |
List(context.Context, string, string, *ListOptions) ([]PrivateServerlessEndpointConnection, *Response, error) | |
Create(context.Context, string, string, *PrivateServerlessEndpointConnection) (*PrivateServerlessEndpointConnection, *Response, error) | |
Get(context.Context, string, string, string) (*PrivateServerlessEndpointConnection, *Response, error) | |
Delete(context.Context, string, string, string) (*Response, error) | |
Update(context.Context, string, string, string, *PrivateServerlessEndpointConnection) (*PrivateServerlessEndpointConnection, *Response, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored
|
||
// PrivateServerlessEndpointsServiceOp handles communication with the PrivateServerlessEndpoints related methods | ||
// of the MongoDB Atlas API. | ||
type PrivateServerlessEndpointsServiceOp service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type PrivateServerlessEndpointsServiceOp service | |
type ServerlessPrivateEndpointsServiceOp service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored
ID string `json:"_id,omitempty"` // Unique identifier of the Serverless PrivateLink Service. | ||
CloudProviderEndpointID string `json:"cloudProviderEndpointId,omitempty"` | ||
Comment string `json:"comment,omitempty"` | ||
EndpointServiceName string `json:"endpointServiceName,omitempty"` // Name of the PrivateLink endpoint service in AWS. Returns null while the endpoint service is being created. | ||
ErrorMessage string `json:"errorMessage,omitempty"` // Error message pertaining to the AWS Service Connect. Returns null if there are no errors. | ||
Status string `json:"status,omitempty"` // Status of the AWS Serverless PrivateLink connection: INITIATING, WAITING_FOR_USER, FAILED, DELETING, AVAILABLE. | ||
ProviderName string `json:"providerName,omitempty"` // Human-readable label that identifies the cloud provider. Values include AWS or AZURE. Atlas currently supports only AWS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these fields only cover AWS for Azure you are missing privateEndpointIpAddress
, privateLinkServiceResourceId
,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added additional fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks for the work here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
INTMDB-364: [Terraform] Add support for serverless private endpoints
Link to any related issue(s):
Type of change:
Required Checklist:
make fmt
and formatted my codeFurther comments