-
Notifications
You must be signed in to change notification settings - Fork 12
/
AttachedDataNetworkCreate.go
109 lines (106 loc) · 4.6 KB
/
AttachedDataNetworkCreate.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package armmobilenetwork_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilenetwork/armmobilenetwork/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/340d577969b7bff5ad0488d79543314bc17daa50/specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/AttachedDataNetworkCreate.json
func ExampleAttachedDataNetworksClient_BeginCreateOrUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmobilenetwork.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewAttachedDataNetworksClient().BeginCreateOrUpdate(ctx, "rg1", "TestPacketCoreCP", "TestPacketCoreDP", "TestAttachedDataNetwork", armmobilenetwork.AttachedDataNetwork{
Location: to.Ptr("eastus"),
Properties: &armmobilenetwork.AttachedDataNetworkPropertiesFormat{
DNSAddresses: []*string{
to.Ptr("1.1.1.1")},
NaptConfiguration: &armmobilenetwork.NaptConfiguration{
Enabled: to.Ptr(armmobilenetwork.NaptEnabledEnabled),
PinholeLimits: to.Ptr[int32](65536),
PinholeTimeouts: &armmobilenetwork.PinholeTimeouts{
Icmp: to.Ptr[int32](30),
TCP: to.Ptr[int32](180),
UDP: to.Ptr[int32](30),
},
PortRange: &armmobilenetwork.PortRange{
MaxPort: to.Ptr[int32](49999),
MinPort: to.Ptr[int32](1024),
},
PortReuseHoldTime: &armmobilenetwork.PortReuseHoldTimes{
TCP: to.Ptr[int32](120),
UDP: to.Ptr[int32](60),
},
},
UserEquipmentAddressPoolPrefix: []*string{
to.Ptr("2.2.0.0/16")},
UserEquipmentStaticAddressPoolPrefix: []*string{
to.Ptr("2.4.0.0/16")},
UserPlaneDataInterface: &armmobilenetwork.InterfaceProperties{
Name: to.Ptr("N6"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AttachedDataNetwork = armmobilenetwork.AttachedDataNetwork{
// Name: to.Ptr("TestAttachedDataNetwork"),
// Type: to.Ptr("Microsoft.MobileNetwork/attachedDataNetwork"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork"),
// SystemData: &armmobilenetwork.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()),
// CreatedBy: to.Ptr("user1"),
// CreatedByType: to.Ptr(armmobilenetwork.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()),
// LastModifiedBy: to.Ptr("user2"),
// LastModifiedByType: to.Ptr(armmobilenetwork.CreatedByTypeUser),
// },
// Location: to.Ptr("eastus"),
// Tags: map[string]*string{
// },
// Properties: &armmobilenetwork.AttachedDataNetworkPropertiesFormat{
// DNSAddresses: []*string{
// to.Ptr("1.1.1.1")},
// NaptConfiguration: &armmobilenetwork.NaptConfiguration{
// Enabled: to.Ptr(armmobilenetwork.NaptEnabledEnabled),
// PinholeLimits: to.Ptr[int32](65536),
// PinholeTimeouts: &armmobilenetwork.PinholeTimeouts{
// Icmp: to.Ptr[int32](30),
// TCP: to.Ptr[int32](180),
// UDP: to.Ptr[int32](30),
// },
// PortRange: &armmobilenetwork.PortRange{
// MaxPort: to.Ptr[int32](49999),
// MinPort: to.Ptr[int32](1024),
// },
// PortReuseHoldTime: &armmobilenetwork.PortReuseHoldTimes{
// TCP: to.Ptr[int32](120),
// UDP: to.Ptr[int32](60),
// },
// },
// ProvisioningState: to.Ptr(armmobilenetwork.ProvisioningStateSucceeded),
// UserEquipmentAddressPoolPrefix: []*string{
// to.Ptr("2.2.0.0/16")},
// UserEquipmentStaticAddressPoolPrefix: []*string{
// to.Ptr("2.4.0.0/16")},
// UserPlaneDataInterface: &armmobilenetwork.InterfaceProperties{
// Name: to.Ptr("N6"),
// },
// },
// }
}