...

Source file src/github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork

     1  package managedvirtualnetwork
     2  
     3  // Copyright (c) Microsoft Corporation. All rights reserved.
     4  // Licensed under the MIT License. See License.txt in the project root for license information.
     5  //
     6  // Code generated by Microsoft (R) AutoRest Code Generator.
     7  // Changes may cause incorrect behavior and will be lost if the code is regenerated.
     8  
     9  import (
    10  	"context"
    11  	"encoding/json"
    12  	"github.com/Azure/go-autorest/autorest"
    13  	"github.com/Azure/go-autorest/autorest/to"
    14  	"github.com/Azure/go-autorest/tracing"
    15  	"net/http"
    16  )
    17  
    18  // The package's fully qualified name.
    19  const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork"
    20  
    21  // ManagedPrivateEndpoint managed private endpoint
    22  type ManagedPrivateEndpoint struct {
    23  	autorest.Response `json:"-"`
    24  	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
    25  	ID *string `json:"id,omitempty"`
    26  	// Name - READ-ONLY; The name of the resource
    27  	Name *string `json:"name,omitempty"`
    28  	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
    29  	Type *string `json:"type,omitempty"`
    30  	// Properties - Managed private endpoint properties
    31  	Properties *ManagedPrivateEndpointProperties `json:"properties,omitempty"`
    32  }
    33  
    34  // MarshalJSON is the custom marshaler for ManagedPrivateEndpoint.
    35  func (mpe ManagedPrivateEndpoint) MarshalJSON() ([]byte, error) {
    36  	objectMap := make(map[string]interface{})
    37  	if mpe.Properties != nil {
    38  		objectMap["properties"] = mpe.Properties
    39  	}
    40  	return json.Marshal(objectMap)
    41  }
    42  
    43  // ManagedPrivateEndpointConnectionState the connection state of a managed private endpoint
    44  type ManagedPrivateEndpointConnectionState struct {
    45  	// Status - READ-ONLY; The approval status
    46  	Status *string `json:"status,omitempty"`
    47  	// Description - The managed private endpoint description
    48  	Description *string `json:"description,omitempty"`
    49  	// ActionsRequired - The actions required on the managed private endpoint
    50  	ActionsRequired *string `json:"actionsRequired,omitempty"`
    51  }
    52  
    53  // MarshalJSON is the custom marshaler for ManagedPrivateEndpointConnectionState.
    54  func (mpecs ManagedPrivateEndpointConnectionState) MarshalJSON() ([]byte, error) {
    55  	objectMap := make(map[string]interface{})
    56  	if mpecs.Description != nil {
    57  		objectMap["description"] = mpecs.Description
    58  	}
    59  	if mpecs.ActionsRequired != nil {
    60  		objectMap["actionsRequired"] = mpecs.ActionsRequired
    61  	}
    62  	return json.Marshal(objectMap)
    63  }
    64  
    65  // ManagedPrivateEndpointListResponse a list of managed private endpoints
    66  type ManagedPrivateEndpointListResponse struct {
    67  	autorest.Response `json:"-"`
    68  	// Value - List of managed private endpoints
    69  	Value *[]ManagedPrivateEndpoint `json:"value,omitempty"`
    70  	// NextLink - READ-ONLY; The link to the next page of results, if any remaining results exist.
    71  	NextLink *string `json:"nextLink,omitempty"`
    72  }
    73  
    74  // MarshalJSON is the custom marshaler for ManagedPrivateEndpointListResponse.
    75  func (mpelr ManagedPrivateEndpointListResponse) MarshalJSON() ([]byte, error) {
    76  	objectMap := make(map[string]interface{})
    77  	if mpelr.Value != nil {
    78  		objectMap["value"] = mpelr.Value
    79  	}
    80  	return json.Marshal(objectMap)
    81  }
    82  
    83  // ManagedPrivateEndpointListResponseIterator provides access to a complete listing of
    84  // ManagedPrivateEndpoint values.
    85  type ManagedPrivateEndpointListResponseIterator struct {
    86  	i    int
    87  	page ManagedPrivateEndpointListResponsePage
    88  }
    89  
    90  // NextWithContext advances to the next value.  If there was an error making
    91  // the request the iterator does not advance and the error is returned.
    92  func (iter *ManagedPrivateEndpointListResponseIterator) NextWithContext(ctx context.Context) (err error) {
    93  	if tracing.IsEnabled() {
    94  		ctx = tracing.StartSpan(ctx, fqdn+"/ManagedPrivateEndpointListResponseIterator.NextWithContext")
    95  		defer func() {
    96  			sc := -1
    97  			if iter.Response().Response.Response != nil {
    98  				sc = iter.Response().Response.Response.StatusCode
    99  			}
   100  			tracing.EndSpan(ctx, sc, err)
   101  		}()
   102  	}
   103  	iter.i++
   104  	if iter.i < len(iter.page.Values()) {
   105  		return nil
   106  	}
   107  	err = iter.page.NextWithContext(ctx)
   108  	if err != nil {
   109  		iter.i--
   110  		return err
   111  	}
   112  	iter.i = 0
   113  	return nil
   114  }
   115  
   116  // Next advances to the next value.  If there was an error making
   117  // the request the iterator does not advance and the error is returned.
   118  // Deprecated: Use NextWithContext() instead.
   119  func (iter *ManagedPrivateEndpointListResponseIterator) Next() error {
   120  	return iter.NextWithContext(context.Background())
   121  }
   122  
   123  // NotDone returns true if the enumeration should be started or is not yet complete.
   124  func (iter ManagedPrivateEndpointListResponseIterator) NotDone() bool {
   125  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   126  }
   127  
   128  // Response returns the raw server response from the last page request.
   129  func (iter ManagedPrivateEndpointListResponseIterator) Response() ManagedPrivateEndpointListResponse {
   130  	return iter.page.Response()
   131  }
   132  
   133  // Value returns the current value or a zero-initialized value if the
   134  // iterator has advanced beyond the end of the collection.
   135  func (iter ManagedPrivateEndpointListResponseIterator) Value() ManagedPrivateEndpoint {
   136  	if !iter.page.NotDone() {
   137  		return ManagedPrivateEndpoint{}
   138  	}
   139  	return iter.page.Values()[iter.i]
   140  }
   141  
   142  // Creates a new instance of the ManagedPrivateEndpointListResponseIterator type.
   143  func NewManagedPrivateEndpointListResponseIterator(page ManagedPrivateEndpointListResponsePage) ManagedPrivateEndpointListResponseIterator {
   144  	return ManagedPrivateEndpointListResponseIterator{page: page}
   145  }
   146  
   147  // IsEmpty returns true if the ListResult contains no values.
   148  func (mpelr ManagedPrivateEndpointListResponse) IsEmpty() bool {
   149  	return mpelr.Value == nil || len(*mpelr.Value) == 0
   150  }
   151  
   152  // hasNextLink returns true if the NextLink is not empty.
   153  func (mpelr ManagedPrivateEndpointListResponse) hasNextLink() bool {
   154  	return mpelr.NextLink != nil && len(*mpelr.NextLink) != 0
   155  }
   156  
   157  // managedPrivateEndpointListResponsePreparer prepares a request to retrieve the next set of results.
   158  // It returns nil if no more results exist.
   159  func (mpelr ManagedPrivateEndpointListResponse) managedPrivateEndpointListResponsePreparer(ctx context.Context) (*http.Request, error) {
   160  	if !mpelr.hasNextLink() {
   161  		return nil, nil
   162  	}
   163  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   164  		autorest.AsJSON(),
   165  		autorest.AsGet(),
   166  		autorest.WithBaseURL(to.String(mpelr.NextLink)))
   167  }
   168  
   169  // ManagedPrivateEndpointListResponsePage contains a page of ManagedPrivateEndpoint values.
   170  type ManagedPrivateEndpointListResponsePage struct {
   171  	fn    func(context.Context, ManagedPrivateEndpointListResponse) (ManagedPrivateEndpointListResponse, error)
   172  	mpelr ManagedPrivateEndpointListResponse
   173  }
   174  
   175  // NextWithContext advances to the next page of values.  If there was an error making
   176  // the request the page does not advance and the error is returned.
   177  func (page *ManagedPrivateEndpointListResponsePage) NextWithContext(ctx context.Context) (err error) {
   178  	if tracing.IsEnabled() {
   179  		ctx = tracing.StartSpan(ctx, fqdn+"/ManagedPrivateEndpointListResponsePage.NextWithContext")
   180  		defer func() {
   181  			sc := -1
   182  			if page.Response().Response.Response != nil {
   183  				sc = page.Response().Response.Response.StatusCode
   184  			}
   185  			tracing.EndSpan(ctx, sc, err)
   186  		}()
   187  	}
   188  	for {
   189  		next, err := page.fn(ctx, page.mpelr)
   190  		if err != nil {
   191  			return err
   192  		}
   193  		page.mpelr = next
   194  		if !next.hasNextLink() || !next.IsEmpty() {
   195  			break
   196  		}
   197  	}
   198  	return nil
   199  }
   200  
   201  // Next advances to the next page of values.  If there was an error making
   202  // the request the page does not advance and the error is returned.
   203  // Deprecated: Use NextWithContext() instead.
   204  func (page *ManagedPrivateEndpointListResponsePage) Next() error {
   205  	return page.NextWithContext(context.Background())
   206  }
   207  
   208  // NotDone returns true if the page enumeration should be started or is not yet complete.
   209  func (page ManagedPrivateEndpointListResponsePage) NotDone() bool {
   210  	return !page.mpelr.IsEmpty()
   211  }
   212  
   213  // Response returns the raw server response from the last page request.
   214  func (page ManagedPrivateEndpointListResponsePage) Response() ManagedPrivateEndpointListResponse {
   215  	return page.mpelr
   216  }
   217  
   218  // Values returns the slice of values for the current page or nil if there are no values.
   219  func (page ManagedPrivateEndpointListResponsePage) Values() []ManagedPrivateEndpoint {
   220  	if page.mpelr.IsEmpty() {
   221  		return nil
   222  	}
   223  	return *page.mpelr.Value
   224  }
   225  
   226  // Creates a new instance of the ManagedPrivateEndpointListResponsePage type.
   227  func NewManagedPrivateEndpointListResponsePage(cur ManagedPrivateEndpointListResponse, getNextPage func(context.Context, ManagedPrivateEndpointListResponse) (ManagedPrivateEndpointListResponse, error)) ManagedPrivateEndpointListResponsePage {
   228  	return ManagedPrivateEndpointListResponsePage{
   229  		fn:    getNextPage,
   230  		mpelr: cur,
   231  	}
   232  }
   233  
   234  // ManagedPrivateEndpointProperties properties of a managed private endpoint
   235  type ManagedPrivateEndpointProperties struct {
   236  	// PrivateLinkResourceID - The ARM resource ID of the resource to which the managed private endpoint is created
   237  	PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"`
   238  	// GroupID - The groupId to which the managed private endpoint is created
   239  	GroupID *string `json:"groupId,omitempty"`
   240  	// ProvisioningState - READ-ONLY; The managed private endpoint provisioning state
   241  	ProvisioningState *string `json:"provisioningState,omitempty"`
   242  	// ConnectionState - The managed private endpoint connection state
   243  	ConnectionState *ManagedPrivateEndpointConnectionState `json:"connectionState,omitempty"`
   244  	// IsReserved - READ-ONLY; Denotes whether the managed private endpoint is reserved
   245  	IsReserved *bool `json:"isReserved,omitempty"`
   246  }
   247  
   248  // MarshalJSON is the custom marshaler for ManagedPrivateEndpointProperties.
   249  func (mpep ManagedPrivateEndpointProperties) MarshalJSON() ([]byte, error) {
   250  	objectMap := make(map[string]interface{})
   251  	if mpep.PrivateLinkResourceID != nil {
   252  		objectMap["privateLinkResourceId"] = mpep.PrivateLinkResourceID
   253  	}
   254  	if mpep.GroupID != nil {
   255  		objectMap["groupId"] = mpep.GroupID
   256  	}
   257  	if mpep.ConnectionState != nil {
   258  		objectMap["connectionState"] = mpep.ConnectionState
   259  	}
   260  	return json.Marshal(objectMap)
   261  }
   262  

View as plain text